Overview

A step-by-step tutorial on how to add content personalization to WordPress templates and themes using PHP with Logic Hop.

Note: This technique will work with both cached and non-cached websites.

Sample Code

WordPress do_shortcode() Function

<?php echo do_shortcode( '## YOUR LOGIC BLOCK SHORTCODE HERE ##' ); ?>

WordPress the_content Filter

<?php echo apply_filters( 'the_content', '## YOUR LOGIC TAGS & CONTENT HERE ##' ); ?>

PHP Output Buffer Functions

<?php ob_start(); ?>
  ## YOUR LOGIC TAGS & CONTENT HERE ##
<?php $content = ob_get_contents(); ob_end_clean(); ?>
<?php echo apply_filters( 'the_content', $content ); ?>

Reference