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.

In other cases, you might 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

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.

Alternatively, you can use the “echo do_shortcode(‘…’);” function below, but 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_shortcode(''); ?>
Ready to get started?
Try it on your website