• Resolved JustinBBC

    (@justinbbc)


    I have a custom post type called “Expositions”, and these posts are listed as links on a web page. In the WP admin dashboard, I select “Expositions”, then I select Re-Order. Here I see the list of posts. I can drag and drop the posts to reorder. Then I select Update to commit the changes. However, the list on the web page doesn’t change.

    The code that generates the list is:

    <?php $exposition_query = new WP_Query(array('post_type' => 'expositions', 'posts_per_page' => 66)); ?>
    
    <?php if($exposition_query->have_posts()) : while( $exposition_query->have_posts()) : $exposition_query->the_post(); ?>
    
    <div>
    <a href="<?php the_permalink(); ?>"><div id="expoStudy"><p class="expo" style="margin-top: 2px;"><?php the_title(); ?></p></div></a>
    
    		<?php endwhile; endif; ?>
    		<?php wp_reset_query(); ?>

    We are using Version 1.7.7 of “Post Types Order”.

    Justin

    https://wordpress.org/plugins/post-types-order/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author nsp-code

    (@nsp-code)

    You should include a ‘orderby’ => ‘menu_order’ within your Wp_Query arguments. For more details see this article Sample code on how to apply the sort for Post Types Order plugin

    Thread Starter JustinBBC

    (@justinbbc)

    Thank you for that info. I added the suggested condition so now I have:

    <?php $exposition_query = new WP_Query(array('post_type' => 'expositions', 'orderby' => 'menu_order', 'posts_per_page' => 66)); ?>

    The problem now is that the order is reversed. It lists 10, 9, 8 … instead of 1, 2, 3… So, I added ‘order’ => ‘DESC’ as instructed to reverse the order, to have:

    <?php $exposition_query = new WP_Query(array('post_type' => 'expositions', 'orderby' => 'menu_order', 'order' => 'DESC', 'posts_per_page' => 66)); ?>

    But that didn’t change the order. Why is this? How can I get the list to render in the same order as shown in the WP admin dashboard?

    Thread Starter JustinBBC

    (@justinbbc)

    I figured it out. I used ASC instead of DESC to get the correct order:
    ‘order’ => ‘ASC’

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘order is not honored’ is closed to new replies.