• Dave Wright

    (@davetwizzlebird)


    I’d like to create some category based navigation on my site using some custom fields I’ve added to my categories. If I was doing this with posts or custom types I’d do this…

    <?php $recentPosts = new WP_Query(); $recentPosts->query('post_type=category&showposts=5');?>
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    <?php the_title();?>
    // Custom field stuff here
    <?php endwhile; ?>

    Obviously I don’t have that luxury with categories, also wp_list_categories is a bit flimsy for my needs of hooking into custom field info. Is there any way of using categories as you would posts in a standard wp loop?

  • The topic ‘Loop through categories’ is closed to new replies.