• Resolved Meeker

    (@meeker)


    Hi there,

    I have created a Custom Post Type. One of the fields in the CPT holds a Revolution Slider shortcode e.g. [rev_slider test1]. So each page of the CPT therefore has a different slider.

    I want to be able to call this shortcode into the template. Calling it directly does not work as it only retrieves the shortcode and does not execute it e.g.

    $testslider1= get_field('rev_slider',$post->ID);
    	if( $testslider1{
    	echo '<div class="test1-slider"> '.$testslider1.'</div>';
    }

    I have also tried executing the shortcode directly, it does not appear to be able to pull in CPT content:

    echo do_shortcode(‘.rev_slider.’);

    Any ideas? Thanks…

Viewing 1 replies (of 1 total)
  • Thread Starter Meeker

    (@meeker)

    No sooner do I post, than I cracked it!

    $testslider1 get_field(‘rev_slider’,$post->ID);
    echo do_shortcode(”.$testslider1.”);

    It was putting the double quotation marks before and after which worked. Solved!

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type will not execute shortcode’ is closed to new replies.