• Resolved conradfenech

    (@conradfenech)


    Hi there,
    Is it possible to have all the posts listed on the front page by title, alphabetically? Thanks!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter conradfenech

    (@conradfenech)

    I thought I have solved it, but I have partly figured it out. When the page loads the first time, all posts are displayed alphabetically, but when I click on a category, not any more.

    If I click “Show All” after clicking category, posts are not displayed alphabetically either. This is the code I used:

    function foo_modify_query_order( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( ‘orderby’, ‘title’ );
    $query->set( ‘order’, ‘ASC’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘foo_modify_query_order’ );

Viewing 1 replies (of 1 total)
  • The topic ‘List posts alphabetically’ is closed to new replies.