WordPress.org

Support

Support » How-To and Troubleshooting » finding out an archives category?

finding out an archives category?

  • Hi. I’d like to list a link of available posts on the top of each archive page. I’m trying to do it with list_cats but I can’t figure out how to pass the list_cats(arguments) a variable with the current category ID. Here’s what I have so far from the CODEX:

    <?php
    $cat = get_the_category(); $cat = $cat[0];
    ?>

    and then
    <ul>
    <?php
    $posts = get_posts('numberposts=9&offset=1&category=$cat');
    foreach($posts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    just getting errors – cause I’m just hacking around, not really understanding the first section. Can anyone help me?

    Thanks.

Viewing 1 replies (of 1 total)
  • I don’t understand what you are wanting. An archive page is a list of available posts by category or date, etc, so I don’t get what you are trying to put at the top, unless you are considering something else as your archive page. Maybe you could explain more?

Viewing 1 replies (of 1 total)
  • The topic ‘finding out an archives category?’ is closed to new replies.