Template-level personalization
Cache compatible

Overview

Sometimes you want personalization inside a theme template rather than in post content. With Logic Hop you can render Logic Blocks and Logic Tags from PHP, so personalized content appears directly in your templates. This works with both cached and non-cached websites.

Sample approaches in PHP

There are three reliable ways to output personalized content from a template. Use whichever fits your template structure.

  • do_shortcode() — echo do_shortcode() with your Logic Block shortcode to render a block
  • the_content filter — echo apply_filters('the_content', ...) with your Logic Tags and content so tags are processed
  • Output buffer — capture markup with ob_start() and ob_get_contents(), then run it through apply_filters('the_content', $content)

References

For the building blocks, see the Logic Blocks, Logic Tags, and Conditions documentation, plus the WordPress do_shortcode() and the_content references for how these functions behave.

Questions this page should answer

Can I personalize content inside a theme template?

Yes. Render Logic Blocks or Logic Tags from PHP using do_shortcode(), the the_content filter, or an output buffer. The technique works on cached and non-cached sites.