Items sorting problem

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4416
    mubi
    Participant

      Hi Olly,
      I have Items as follows
      29 – Pizza abc
      30 – Pizza bcd
      31 – Some item
      32 – asdf
      33 – whatever
      and so on
      The problem is that they are not displayed in a sequence as above. 31 is after 29 and so on. Can you please help?
      Thanks

      #4417
      mubi
      Participant

        I have solved the issue by adding this code into my function.php.
        /*************************************************************************
        Sorting: source= http://wordpress.org/support/topic/sort-posts-alphabetically-1
        ***************************************************************************/
        function wpsf_orderby( $query ) {
        if ( is_admin() || ! $query->is_main_query() )
        return;
        // do conditional checks here and return on false.?

        {
        remove_action( ‘pre_get_posts’, __FUNCTION__ );
        add_filter( ‘posts_orderby’, function() { return ‘ post_title ASC’; } );
        }
        }

        add_action( ‘pre_get_posts’, ‘wpsf_orderby’ );

        #4418
        Olly
        Admin & Mod

          you could do that i guess, or of course just use the “order” field that every menu item has (available in quick edit too, not just when “normally” editing an item

          just saying…

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The topic ‘Items sorting problem’ is closed to new replies.