Support » Plugins » Controlling the order in which posts appear on front page

  • Is it possible to force posts from certain categories to appear certain slots on the front page? So I’d have

    Post 1 assigned to the Cold category. This will be the first post block.
    Post 2 assigned to the Warm category. Thiis will be the second post block.
    Post 3 assigned to the Hot category. This will be the third post block.

    Whenever I create a new post and add it to the Warm category it only appears in the 2nd post block and not the 1st or 3rd. Same for the other posts in that they only appear in the set post block. Hopefully there’s a plugin that helps with this.
    Any responses appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’d need to put something like this in the theme template that displays your “front page” (e.g. index.php)

    //list one post for each category in $list_of_cats
    $list_of_cats =array('Cold', 'Warm', 'Hot') ;
    foreach( $list_of_cats as $cat ) {
      $catid = get_cat_ID($cat);
        'cat' => $catid,
        'post_type' => 'post',
        'post_status' => 'publish',
        'posts_per_page' => 1,
        'caller_get_posts'=> 1
      $my_query = null;
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        echo 'One post for category ' . $cat;
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        the_content('Read more...');
      wp_reset_query();  // Restore global post data stomped by the_post().

    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    Please don’t post to both these forums and wp-hackers.

    Apologies as I wasn’t sure if it constituted as a hack or whether a plugin would do the job.
    Thanks for the reply.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Controlling the order in which posts appear on front page’ is closed to new replies.