How to change default category in Home Page (2 posts)

  1. drkestrel
    Posted 8 years ago #

    How do I modify the following within index.php (applicable to most themes including the Default theme) to show posts where catId=3 instead of all recent posts in descending date order?

    Using WordPress 2.1.2

    <?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    				<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    		<?php endwhile; ?>
  2. drkestrel
    Posted 8 years ago #

    Just added the following and fixed the problem

    <?php if (!in_category('3')) continue; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic