I’m using get_posts() to display posts in a specific manner. I want to get the_content() as a string variable rather than having it display as usual. I’m using the apply_filters() method as described in the the_content() codex but it isn’t working.
Irrelevant code has been excluded.
$args = array('numberposts' => 9, 'offset' => 1); $posts_array = get_posts( $args ); foreach ($posts_array as $post) : setup_postdata($post); the_content(); // returns the content normally $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; // returns nothing endforeach;
Thanks in advance for any help I can get with this issue
- The topic ‘apply_filters('the_content', $content) with get_posts();’ is closed to new replies.