0

I have this code below within the loop

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>    

<div class="new-posts-form">
<div class="new-posts-img"><a href="<?php the_permalink(); ?>"></a><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(100,80)); ?></a></div>
<div class="new-posts-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
<div class="new-post-description"><?php content('11'); ?></div>
<div class="new-post-add-date-time"><img src="<?php bloginfo('template_url'); ?>/images/tb_clock.png" /><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> : <?php the_category(', ') ?></div>

</div> <!--end new posts form-->

<?php endwhile; ?>
<?php endif; ?>

I have 5 posts in my blog the loop is work perfectly in home page and show all five posts without any problem

but when I use same code within same loop in single.php page only show one post and don't show other four posts

4
  • 1
    please post the full code of single.php
    – Michael
    Aug 27, 2013 at 21:05
  • You can reference the Markdown Editing Help for helpful tips on code and text formatting if needed.
    – Michal Mau
    Aug 27, 2013 at 21:37
  • Are these new posts on single.php intended as a secondary loop?
    – Michal Mau
    Aug 27, 2013 at 21:55
  • Why are you expecting the single post template to display more than one post? Aug 28, 2013 at 1:13

1 Answer 1

2

To give you a more thorough answer I would have to see some actual code, but I think the gist of the answer is in the file you are trying to use.

"single.php" is the template file used to display the content of a single post, as the name implies. It isn't meant for displaying the contents of multiple posts.

You can modify this template to display multiple posts, but it usually involves putting a pretty extensive foreach loop in the page that will have it render the contents of each post in succession.

Hope that helps! If you need more info, please post the code so that I can see what is specifically going on in your theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.