hijiriworld / intuitive-custom-post-order

WordPress Plugin: Intuitive Custom Post Order
68 stars 34 forks source link

@nicolas-san wrote #2

Open hijiriworld opened 9 years ago

hijiriworld commented 9 years ago

(Before all, thanks for your plugin :))

I work on WP network, currently 4.2.2.

I've custom post type. The plugin was installed on the network, I check the database structure, and all the field are good.

When I change order, order change in database, but, when I check the order in frontend, the posts was not sort by menu_order.

So after lot of tests I try to hook the query with you recommendation on your FAQ, but using order_by=menu_order and, it's work now.

I suppose somehow in the code, perhaps in the template, some hook or query override your orderby, perhaps you can try changing the priority of your hook ? (for information, it is a wpzoom theme)

My code in functions.php of my childtheme :

function rand_posts( $query ) {
    $query->set( 'orderby', 'menu_order' );
    $query->set( 'order', 'ASC' );
    return;
}
add_action( 'pre_get_posts', 'rand_posts' );

If I can test things to help you let me know, I'm not sure if the network part is relevant, I try to think more about the theme "framework"

I try to change priority of this add_action, and the add_filter after, to something hight, but no change.

// reorder post types
        add_action( 'pre_get_posts', array( $this, 'hicpo_pre_get_posts' ) );