WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] wp_query and category_name… doesn’t seem to work?

[Resolved] wp_query and category_name… doesn’t seem to work?

  • 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.

Viewing 1 replies (of 1 total)
  • 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…

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] wp_query and category_name… doesn’t seem to work?’ is closed to new replies.