• I would like to select posts which belong to cat-83 AND cat-44. This is working. However the posts are listed in ASC order (lowest post-ID first). It seems that order and orderby are not working correctly.

    <?php query_posts(array(‘category__and’=>array(83,44),’showposts’=>-1,’order’=>DESC )); ?>
    <?php while (have_posts()) : the_post();?>

    Who can help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I can’t get that to work in 2.6.2 either. Seems it always want to be in descending order, at least when using the orderby clause.

    Now, in 2.7-almost beta, it seems the problem is fixed, if that is any consolation.

    Thread Starter docufacts

    (@docufacts)

    Thanks. I have to wait?

    I hope 2.7 will upgrade the interface for tag and category on the same usage level: tag=’taga+tagB’ -> category=catA+catB.

    I think you are referring to Trac Ticket 5433 and that is now being viewed as an enhancement though some are pushing to get that in 2.7.

    islandwriter

    (@islandwriter)

    I’m experiencing the same problem. In my case this has nothing to do with tags, just categories. Using query_posts(‘cat=-‘ . $category . ‘&order=DESC&orderby=date’); (where $category was assigned immediately before this call produces the correct list, but in ASC order) It would seem that since the default sort order for this query call is DESC, this is a bug.

    Just bumping this. Does anyone know if this has this been fixed or have a work around for selecting posts that are in multiple categories and getting the DESC order?

    Thanks

    I just found the solution, you have to specify an order and orderby together

    query_posts(array(‘category__and’=>$categorys, ‘orderby’=>ID,’order’=>DESC));

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Query_post not working properly??’ is closed to new replies.