Posts Tagged ‘list’


Aug
14

It is a good idea to use categories to power the “Must Read” and “Worth A Look” lists on the side of your WordPress blog. The code that you will want to use in order to do this will look like this:

<h3>Popular Articles</h3>
<ul>
<?php query_posts(’category_name=popular’); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a><br />
<?php the_excerpt(); ?></li>
<?php endwhile; ?><?php endif; ?>
</ul>

You are going to want to add this code to your theme’s template file. Once you have done so, it will be time to add posts to it. From this point on, every time that a post is placed into that category, it will appear within this list. Of course, this can be further customized in any way that you desire.

Popularity: 10% [?]