WordPress.org

Ready to get started?Download WordPress

Forums

The Loop in footer - problem with single.php (1 post)

  1. Jeremy Herve
    Member
    Posted 5 years ago #

    Hi everyone!

    It is basically the same problem already posted here.

    I am trying to add a second loop in my footer, in order to display a random post content (but only the part before the <!--more--> tag)

    However when I try to do so I get it to display the whole post entry when I am on single.php template, and not just the content before <!--more--> tag

    Here is my code so far:

    <?php $my_query = new WP_Query('showposts=1&orderby=rand'); while ($my_query->have_posts()) : $my_query->the_post(); ?>
    	<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    	                <?php the_content('','FALSE',''); ?>
    <?php endwhile; ?>

    Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic