Forums

summary of recent posts in single post template (5 posts)

  1. danaherlihey
    Member
    Posted 9 months ago #

    Hi,

    I'm trying to include a summary of recent posts from a specific category to appear in a single post template.

    So far I have:

    <h1>Latest News</h1>
       <?php query_posts('category_name=news&showposts=4');
      						while (have_posts()) : the_post();
     						 ?>
    
    				<a class="title" href="<?php the_permalink() ?>" rel="bookmark" title="Read the feature article: <?php the_title(); ?>"><?php the_title(); ?></a>
    
    			<?php global $more; $more = false; ?>
    				<span class="readmore_g"><?php the_content('<br />Read More'); ?></span>
                    <?php $more = true; ?>
    
                  <?php endwhile; ?>

    This is followed by the loop for the regular single post. The problem is that it shows 4 full posts in the single view instead of one (obviously because of the showpost)

    any suggestions?

  2. t31os
    Member
    Posted 9 months ago #

    Just to be clear, this is your single post theme file (single.php) and above the post listed you want to show a summary of recent posts from the same category?

    If that's the case, you'd better doing this in your index or header file, you need to check when viewing a singular page and include the content when true....

    This would remove the issue you're having by including query_posts in single.php....

    I think.. :-s

  3. MichaelH
    moderator
    Posted 9 months ago #

  4. t31os
    Member
    Posted 9 months ago #

    Or what Michael suggested...

    Depends what's easiest i guess... ;)

  5. MichaelH
    moderator
    Posted 9 months ago #

Reply

You must log in to post.

About this Topic