Support » Fixing WordPress » Multiple Posts on a Page

  • Is there a way to add multiple posts to a page other than the home page? I don’t think he cares about RSS and will never have a use for it. He has a list of clients that he would like to be feature as his favorite clients. He would like to accomplish this by creating a separate post for each client and then list all of the individual posts on a separate page–not the home page. Is this possible. I have seen an option that suggests adding links to categories from a static page, but I am unsure how to do this or if it is a viable option. Does anybody have any good ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Just create a category called Client and assign that Category to each post your write about clients. Then WordPress will, ‘automatically’, give you access to all the posts in that category (or any category).

    Not to say you can’t use a query_posts() or get_posts() loop in a Page Template, but don’t think that’s necessary, yet.

    Category Templates
    Template Hierarchy
    WordPress Semantics


    I would also like to display multiple posts on one page, but then including Comments. I tried to use


    on the index-page, but no comments are shown. I guess because the function doesn’t know the current post? How can I give it the current post of the post-loop? (wp_list_comments($postID); doesn’t seem to work..)




    If you want to place the content of the WP page you created and have the list of featured clients below that then you will probably want to use 2 loops for this page template.

    Here’s some code that worked for me. That code about the cloning is there so that the template recognizes the first query as the information about the page itself, and not confusing it with the list it generates for the featured clients.

    <?php //Start Multiple Loops SEE: ?>
    <?php //First Loop: Load the content of the page ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <?php if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
      	  <div <?php post_class() ?>>
    		<div class="entry">
    			<?php the_content(); ?>
    	<?php edit_post_link('Edit this entry.', '<span>', '</span>'); ?>
      <?php endwhile; endif; ?>
      <?php //you need to store the original query in a variable, then re-assign it with the other Loop. This way, you can use all the standard functions that rely on all the globals.?>
    <?php $temp_query = clone $wp_query; ?>
      <h3 class="sub-title">Featured <?php the_title(); ?></h3>
      <?php //Second Loop: Call featured clients list ?>
    <?php query_posts('category_name=featured-clients&showposts=10'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post();
      	  if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    	<div <?php post_class() ?>>
    		<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    		<div class="entry">
    			<?php the_excerpt();?>
    			<a class="more-link" href="<?php the_permalink(); ?>">Continue Reading</a>
      <?php endwhile; endif; ?>
     <?php // now back to our regularly scheduled programming ?>
     <?php $wp_query = clone $temp_query; ?>

    You can set any page to be the main page for posts. It doesn’t necessarily have to be the home page. Whatever page you choose will collect all your posts and comments.

    If you’re still confused, perhaps this article will help; it’s about when to use posts versus pages.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Multiple Posts on a Page’ is closed to new replies.