Support » Themes and Templates » Cant sort posts with custom query

  • Resolved BK_@_UC


    Nothing will sort using any of the following code, I have tried many other options as well, but these are examples directly from WP, so they should be working… If I change numberposts, it works, but not sort by any option (title, id or ASC, DESC)…

    I am using mostly the second code block below… Any thoughts or similar problems?

    $args = array( 'numberposts' => 3, 'order'=> 'ASC', 'orderby' => 'title' );
    $postslist = get_posts( $args );
    foreach ($postslist as $post) :  setup_postdata($post); ?>
    		<?php the_date(); ?>
    		<br />
    		<?php the_title(); ?>
    		<?php the_excerpt(); ?>
    <?php endforeach; ?>


    $loop = new WP_Query('category_name=food-specials&orderby=id&order=DESC');
     	while ( $loop->have_posts() ) : $loop->the_post();

Viewing 2 replies - 1 through 2 (of 2 total)
  • Oh, I also have “Post Types Order” plugin by NSP CODE active… Im checking if that is blocking my custom queries globally at the post level… Might be it…

    Yup this was the problem, the POST ORDER TYPES plugin was blocking my ‘orderby’ & ‘order’ queries… Looks like they want $25 for the advanced version to let me use custom queries again and still have their drag and drop for my admin users… Might be worth it…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cant sort posts with custom query’ is closed to new replies.