Display Conditions

Utilize the Conditional Logic rule to dictate where your snippets appear.

Display Conditions screenshot

[!NOTE]
This feature is available only in WP Coder PRO.

WP Coder offers a versatile set of Display Conditions options, giving you granular control over when and where your custom code is executed on your WordPress site.

These conditions allow you to fine-tune the behavior of your snippets, ensuring they run only in the right context — improving both performance and user experience.


Available Rules

  1. Display Rules
    Control the specific pages, posts, or areas of your site where your custom code should run.

    • Example: run code only on single posts, only on the homepage, or everywhere except one specific page.
  2. Devices Rules
    Decide which devices your custom code should run on.

    • Example: enable certain features only for mobile or tablet users.
  3. Users Rule
    Restrict your code execution to specific user roles.

    • Example: apply code changes visible only to administrators, editors, or subscribers.
  4. Browsers Rules
    Run your code only on selected browsers.

    • Example: apply compatibility fixes just for Safari or Internet Explorer users.
  5. Language Rule
    Execute code depending on the language of your site.

    • Perfect for multilingual websites where different languages may need different scripts or styles.
  6. Schedule
    Run your custom code only within a specified timeframe.

    • Example: show holiday-themed code, timed promotions, or limited-time offers.

Benefits

  • Ensures that custom code runs only when needed.
  • Helps optimize performance by reducing unnecessary script execution.
  • Enhances personalization by tailoring code execution to user context (role, device, browser, language, time).