WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_query and category_name... doesn't seem to work? (2 posts)

  1. syncbox
    Member
    Posted 5 years ago #

    is this appropriate?

    <?php
    $wp_query->set('orderby', 'menu_order');
    $wp_query->set('order', 'ASC');
    $wp_query->get_posts('category_name=crew');
    ?>
    <?php get_posts('orderby=menu_order&order=ASC'); ?>

    to attempt to show ONLY the posts that DO have the category "crew" checked? What if some posts are part of a child/sub category under crew (as in "former-crew")?

    I am using custom templates...and using this method to order the results.

  2. syncbox
    Member
    Posted 5 years ago #

    Nevermind, I found the answer myself...

    I incorporated the following into my query:

    query_posts(array('category__in' => array(44)));

    as in:

    <?php
    query_posts(array('category__in' => array(44)));
    $wp_query->set('orderby', 'menu_order');
    $wp_query->set('order', 'ASC');
    $wp_query->get_posts();
    ?>
    <?php get_posts('orderby=menu_order&order=ASC'); ?>

    Which effectively eliminated the child category posts...

Topic Closed

This topic has been closed to new replies.

About this Topic