WordPress.org

Ready to get started?Download WordPress

Forums

How do I list contents of one category? (3 posts)

  1. jaynedArcy
    Member
    Posted 8 years ago #

    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?

  2. Appletalk
    Member
    Posted 8 years ago #

    <?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; ?>

  3. syncbox
    Member
    Posted 8 years ago #

    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.

    TIA

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.