Viewing 3 replies - 1 through 3 (of 3 total)
  • I just did this by adding this to my functions.php

    add_action( ‘pre_get_posts’, ‘my_change_sort_order’);
    function my_change_sort_order($query){
    if(is_post_type_archive($CUSTOM-POST-TYPE)):
    //Set the order ASC or DESC
    $query->set( ‘order’, ‘ASC’ );
    //Set the orderby
    $query->set( ‘orderby’, ‘title’ );
    endif;
    };

    Where CUSTOM-POST-TYPE is your custom post type

    Thread Starter lcurrit

    (@lcurrit)

    Right on. Thank you, I’ll try it this evening.

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi,

    Timothy is spot on! You can do any modifications you want to the query using the pre_get_posts filter ??

    Thank you Timothy.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort results by title’ is closed to new replies.