DEAL ENDS IN:

CYBER MONDAY!

UP TO 40% OFF!

GET IT NOW

How to embed a trigger directly in a page template

Embedding an If-So trigger directly in your website files might be necessary in some cases, depending on how your site is built and what you want to achieve.

A common use case, is when you want to redirect visitors to another page based on one of the If-So conditions. Embedding a trigger directly in the page template will provide a better user experience since the redirection will take place before the content of the page starts to load.

Embedding the If-So trigger using a PHP code

To embed an If-So trigger in the page template, simply, click “PHP code (for developers)” right below the trigger shortcode on the trigger editing page. Copy the code, and paste it into your template.

screenshot 20 41 3

Alternatively, you can use the “echo do_shortcode(‘…’);” function below, just make sure to replace the “XXX” with the ID of your trigger:

<?php  echo_shortcode('[ifso id="XXX" ajax="yes"]'); ?>

FAQs

  • How do I enable Ajax for a specific trigger that is embedded using PHP (for developers)?

    If you want to enable Ajax loading for a specific trigger that is embedded directly in the page template using a PHP code, you can use the “echo do_shortcode(‘…’);” function

     <?php echo do_shortcode('[ifso id="123" ajax="yes"]'); ?>
Ready to get started?
Try it on your website