• Resolved egorship1

    (@egorship1)


    Hi! The code from the FAQ does not work for this sorting. I would like to see new items always at the top, unless a manual sort was applied to them.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    The code from the FAQ

    which one?

    I would like to see new items always at the top, unless a manual sort was applied to them.

    unless you select a term for manual sorting, then the plugin has no impact on that term’s post order/new posts positions.

    Thread Starter egorship1

    (@egorship1)

    add_filter('reorder_post_within_categories_new_post_first', 'rank_new_posts', 10, 3);
    function rank_new_posts($is_first, $post, $term_id){
        $is_first = true;
        //you can filter by taxonomy term, or other post parameters.
        //WP_Post $post object being ranked;
        //$term_id for which the post is rank is being inserted.
        return $is_first;
    }

    That’s what I’m talking about.

    The main point is that after manual sorting when new items appear – they will be at the top of the list, not at the bottom. That is, no sorting has been applied to them yet.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    image

    as you can see from my screenshot, it works just fine.

    1. Select a term,
    2. set it to manual order ‘Yes’
    3. setup the filter code in your functions.php file

    all new posts will appear on the top.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New items are always at the top of the list’ is closed to new replies.