If you take a look at my wordpress’ home page over time you will notice that the first entry is the latest article and the second entry is the latest photo.
The objective of this article is to help you customize your home page. Specifically for the default TwentyTen theme. Always create a copy of the original file before editing it. This makes it easy to revert when something goes wrong.
This code will do the following:
-post #1 = latest excerpt from all categories except 21
-next post (or posts) = latest full post from category 21 (and any other categories specified in the array, separated by a comma)
-below title => category
Open loop.php (in your theme’s directory).
Locate the following code:
<?php /* Start the Loop. * ... */ ?>
Below it insert this:
<?php if ( is_home() ) : // Only display on home page. ?> <?php query_posts('cat=-21' . '&posts_per_page=1' ); // Do not show any posts from category 21 and only show 1 post. ?> <?php while (have_posts()): the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <div class="entry-meta"> Posted on <?php the_time('l, F jS, Y') ?> <?php if ( count( get_the_category() ) ) : ?> <span class="cat-links"> <?php printf( __( '<span class="%1$s">in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> </span> <?php endif; ?> </div><!-- .entry-meta --> <div class="entry-content"> <?php the_excerpt(); ?> </div><!-- .entry-content --> <div class="entry-utility"> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> </div><!-- .entry-utility --> </div><!-- #post-## --> <?php endwhile; ?> <?php $mycats = array(21); // Category numbers you want to create an entry for ?> <?php foreach ($mycats as $catid) : ?> <?php query_posts(array('cat'=>$catid,'showposts'=>1)); ?> <?php while (have_posts()): the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <div class="entry-meta"> Posted on <?php the_time('l, F jS, Y') ?> <?php if ( count( get_the_category() ) ) : ?> <span class="cat-links"> <?php printf( __( '<span class="%1$s">in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> </span> <?php endif; ?> </div><!-- .entry-meta --> <div class="entry-content"> <?php the_content(); ?> </div><!-- .entry-content --> <div class="entry-utility"> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> </div><!-- .entry-utility --> </div><!-- #post-## --> <?php endwhile; ?> <?php endforeach; ?> <?php else : // If not the home page the normal loop will run. ?>
Go to the bottom of the file and insert this:
<?php endif; // End of if home statement ?>
This should get you well on your way to customizing your front page. If you go to the “entry-meta” you can modify the line below the post title to appear the way you prefer. To go back to default scroll to a section in loop.php that has the default entry-meta, copy and paste.