Support » How-To and Troubleshooting » How do I list contents of one category?

How do I list contents of one category?

  • I’ve created a table of contents page for my writing, The Library. For now, I’ve just hand coded in the urls for the stories and poems. What I would like to do is to use the
    < ?php wp_list_cats(); ? >
    code to call ONE category and then list the posts in that category. Is there a way to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php query_posts('cat=' . get_query_var('cat')); // posts only from this category ?><br />
    <?php while (have_posts()) : the_post(); ?><br />
    <!-- article --><br />
    <div class=&quot;articleentry artodd&quot;><br />
    <h4><?php the_title(); ?></h4><br />
    <p><?php the_excerpt(); ?></p><br />
    <div class=&quot;articlemeta&quot;><br />
    <div class=&quot;artmeta_left&quot;>added 23/01/2006</div><br />
    <div class=&quot;artmeta_right&quot;><a href=&quot;<?php the_permalink(); ?>&quot; id=&quot;morelink&quot;><img src=&quot;<?php bloginfo('stylesheet_directory'); ?>/images/vl-button-more.gif&quot; /></a></div><br />
    </div><br />
    </div><br />
    <br />
    <? endwhile; ?>

    but, can you do this dynamically? one script to get the titles of posts from the CURRENT category?

    I’d like a drop down menu, but a list would be better than nothing. It’s the CURRENT cat that I don’t see how to do… I don’t want to have to have a separate set up for each category (and hard-code in the id of the category) but nothing I’ve seen others post seems to work.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I list contents of one category?’ is closed to new replies.