This may sound a little confusing but I'll try my best to explain. I've made a shortcode that grabs the content of a post (when given the id), it looks like this:
$post_id = $id;
$queried_post = get_post($post_id);
$postcontent = $queried_post->post_content;
$title = $queried_post->post_title;
I then have another variable which puts a few things together and gets returned:
$finaloutput = $title . $postcontent;
What I want to do is be able to run shortcodes withing $postcontent
, so when a post is fetched any shortcodes within that post will display. I tried running do_shortcode
on the $postcontent
variable but it caused the page to literally not load at all.
Any ideas?
$postcontent = apply_filters( 'the_content', $postcontent );
work?