• Resolved newash

    (@newash)


    Hey hijiri,

    I had this issue with the orderby like others had, with the latest version where it’s supposed to work.

    Then I looked into your code.

    Was there any specific reason using the global $args to figure out if there was an orderby set on the outside? Why weren’t the $wp_query->get('orderby') an the $wp_query->get('order') good for that? If these ordering settings are not coming from the main query on a page or anything special is used to set the order of the main query the global $args doesn’t match what is set in the query — resulting your plugin overwriting the original setting.

    So if you think your plugin could work by reading the Query object people here probably wouldn’t need to do hacks to disable your – otherwise really good – plugin.

    https://ww.wp.xz.cn/plugins/intuitive-custom-post-order/

Viewing 3 replies - 16 through 18 (of 18 total)
  • I’d better try to explain myself a little clearer 🙂

    I use the plugin Intuitive Custom Postorder. Right now as WordPress standard new posts shows up on top of the list in both frontend and backend. After sorting, I have again the possibility to add new posts to the bottom. Without the already sorted posts change.

    I want to place the new posts at the bottom of the list in both front end and backend.

    Thread Starter newash

    (@newash)

    OK, I just started to worry if we go off-topic much with this here.
    So it’s just a little off-topic then. 🙂

    I don’t think it’s easy to do what you want, but here what I would do:

    • I would double-check this plugins code, but it seems that you have the latest posts on top because “menu_order” attribute of a post is 0 by default. And the plugin sorts the posts by ascending “menu_order” if it’s turned on.
    • There’s nothing we can change about the sorting so I would change the default 0 instead.
    • I would hook onto wp_insert_attachment_data and do an SQL MAX(menu_order)+1 on the posts and change “menu_order” to this value in the filter.

    If all goes well this would make the latest post the last one. But it’s just theory, you should try it out.

    Thread Starter newash

    (@newash)

    …of course it’s wp_insert_post_data, my bad.

Viewing 3 replies - 16 through 18 (of 18 total)

The topic ‘orderby issue: possible general solution’ is closed to new replies.