WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] query_posts in subcategory (future years) (2 posts)

  1. nearlythere
    Member
    Posted 8 years ago #

    i'm trying to get a display of posts in future years. it does not work with nested categories. is there anyway around this?

    this is the code i am using:

    <?php $temp_query = $wp_query; ?>

    <?php query_posts('category_name=festivals&year=2006'); ?>

    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> On: <?php the_date(); ?>
    <?php endwhile; ?>

    <?php $wp_query = $temp_query; ?>

    this is giving me a list of titles, and dates in 06, but only for a top-level category, not a sub-category.

    is this because i am working with future dates?

  2. nearlythere
    Member
    Posted 8 years ago #

    i have done more tests, and can conclude:

    i was only getting a display of future posts because i had activated the eventcalendar plugin. but it affects other categories, and if you use the code above (with top-level categories only).

Topic Closed

This topic has been closed to new replies.

About this Topic