Support » Fixing WordPress » Strip Tags from Mini Loop

  • I have used a version of the mini-loop available on the docs that enables you to display posts from a particular category outside of the main content. The function I am using is:

    global $post;
    $myposts = get_posts('numberposts=3&category=4');
    foreach($myposts as $post) :
    <?php echo $post->post_excerpt ?><?php the_content(); ?><?php comments_popup_link() ?>
    <?php endforeach; ?>

    That is successful in outputting the excerpts from the 3 most recent posts in category 4, and also the comments link for the said posts. With the above, the excerpt is enclosed within p tags, and the comment link is just floating out there. I want the content and comment link to be enclosed within li tags.

    I would like to strip the tags from both of those outputs. I suppose that applying strip_tags is what will do the trick, I just don’t know how to make it work.

    Any help would be very much appreciated.

  • The topic ‘Strip Tags from Mini Loop’ is closed to new replies.