0

I'm using the following line to show content from one page on another.

This line outputs the content's raw text of a shortcode:

<?php $id=3934; $post = get_page($id); $content = apply_filters('the_content', $post->post_content); echo $content;  ?>

How can I add to or filter this snippet to allow the shortcodes from said page to fully display, rather than outputting raw [/tab] text?

1

If you want to display the shortcodes in the string variable $content you can use the Wordpress function do_shortcode() like this:

 echo do_shortcode($content); 

See more in the Codex:

http://codex.wordpress.org/Function_Reference/do_shortcode

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.