WordPress.org

Support

Support » Plugins and Hacks » Post Types Order » Sort not working on SOME custom post types

Sort not working on SOME custom post types

  • Hi there,

    I’m using this plugin in conjunction with the Types plugin. I have 4 custom post types, some of which are ordering as expected and some of which are not.

    Here is my code for an example that is NOT sorting:

    <?php $args = array( 'post_type' => 'side_feature', 'posts_per_page' => 3, 'order'=>'ASC', 'hierarchical' => false);
    	$loop = new WP_Query( $args );
    	while ( $loop->have_posts() ) : $loop->the_post(); ?>
            <li>
    		<!-- my code -->
    	</li>
    <?php endwhile; ?>

    I’m using the exact same code to sort my homepage billboards, which is working fine, so I’m a little perplexed here.

    Thanks in advance for your help!

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • REVISION:

    It appears the sort is somewhat working, but is behaving strangely. Again, my homepage_billboards custom type is working exactly as expected. I have two other post types that are behaving differently.

    I have my items sorted as so:
    (1)Lorem
    (2)Ipsum
    (3)Dolor

    And they appear on my site as follows:
    (3)Dolor
    (1)Lorem
    (2)Ipsum

    Also, if I change my ‘order’ from ‘ASC’ to ‘DESC’ it has no affect.

    Plugin Author nsp-code

    @nsp-code

    Try including ‘orderby’ => ‘menu_order’ within your query arguments.

    Thanks for the response – unfortunately that did not make any change.

    I’ve actually tried every option for the orderby:
    http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
    Section 5.11

    None of which seemed to have any affect on the ordering.

    Plugin Author nsp-code

    @nsp-code

    Try turning off the Autosort. Also possible there is another plugin which create some sort of conflict, try to de-activate.

    Plugin Author tdgu

    @tdgu

    What’s this argument for ‘hierarchical’ => false ?

    Thanks tdgu – I had read on some other forum responses that setting the hierarchical setting to false did the trick for most people, however my custom post type is already specifying a non-hierarchical relationship, so specifying it here again is in fact redundant. That being said switching it to true, or removing it entirely both had no affect.

    nsp-code: Not sure where this autosort you speak of is set? Would this be a setting in the custom post type or is this an argument I can pass within my query? If so can you let me know what the proper syntax is? I’ve tried ‘autosort’=>false and ‘auto_sort’ => false

    In re. to your suggestion about plugins – the only 3 plugins I’m using are Types, Post Types Order, and Contact Form 7.

    Plugin Author nsp-code

    @nsp-code

    Sorry i meant within the plugin settings.
    The ‘order’ query argument as ASC or DESC should really change something in the results list

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Sort not working on SOME custom post types’ is closed to new replies.
Skip to toolbar