WordPress.org

Support

Support » How-To and Troubleshooting » The Loop in footer – problem with single.php

The Loop in footer – problem with single.php

  • 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!

  • The topic ‘The Loop in footer – problem with single.php’ is closed to new replies.
Skip to toolbar