Support » Fixing WordPress » pulling an archive list by category name

  • Hiya,

    I was just wondering if someone could tell me what I’m doing wrong here. I’d like to pull a limited list of posts from a category by name. This is being displayed on a static front page in a little 3 column bottom item:

    <?php wp_get_archives('title_li=&type=postbypost&category_name=video&limit=5'); ?>

    I figured category_name would work, as it works for a loop query…but apparently not. 🙂

    Suggestions? I’m sure i’m just missing something obvious.



Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    $cat=get_cat_ID('your category description here');
    if ($catposts) {
      foreach($catposts as $post) {
        setup_postdata($post); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
      <?php  }

    Thanks! That worked.

    One last thing though, how would I work a limit into that?

    Use the “showposts” argument. The query_posts() article describes almost all the arguments available to both get_posts and query_posts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pulling an archive list by category name’ is closed to new replies.