Support » Fixing WordPress » How to have a Blog page showing posts summarised and excluding category 16?

  • Basically I would like to have a blog page – home.php – (my homepage is a static page – index.php) that shows summarised posts (automatically – I know you can edit to show only part of the post while you edit it but I have loads of posts) excluding category 16.

    Here’s my code that work to show only a summary:

    <?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); ?>
    
    <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
    <?php the_excerpt('Read the rest of this entry &raquo;'); ?>					
    
    <?php endwhile; ?> <?php else : ?> <?php endif; ?>

    In this case my blog pages shows the summary of ALL my posts, including category 16. Can someone please help me?

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • I too seek a setting/code edit that displays summarized posts on the default page…

    Thread Starter wmatos

    (@wmatos)

    I’ve found the solution:

    <!-- start the loop excluding cat 16-->
    <?php query_posts($query_string . '&cat=-16'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
    <?php the_excerpt('Read the rest of this entry &raquo;'); ?>					
    
    <!-- end the loop -->
    <?php endwhile; else: ?>
    <?php endif; ?>

    Where

    ‘&cat=-16’

    is the category I Don’t want to show. If you want display a specific category, all you need to do is remove “-” and replace 16 for the category you want.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to have a Blog page showing posts summarised and excluding category 16?’ is closed to new replies.