Support » Plugins » Hacks » WP Category Query

  • Hi all.

    I have a parent category page with several child-categories.

    When on the parent category page, which runs off a unique template, I’d like to display the latest 5 posts from each of the child categories.

    Is there a way to query posts which are children of a category? There seems to be a query for children of posts/pages, but I can’t seem to make the same concept work using categories. The post/page parameter is used in the code I have so far below, although it doesn’t work (‘post_parent’ parameter).

    if ( is_category() ) {
      $current_cat = get_query_var('cat');
    // The Query
    query_posts( 'post_parent='.$current_cat );
    // The Loop
    while ( have_posts() ) : the_post();
    	echo '<li>';
    	echo '</li>';
    // Reset Query

    Thanks for any help/suggestions

  • The topic ‘WP Category Query’ is closed to new replies.