• Resolved svsdnb

    (@svsdnb)


    Is there a way that I can order posts by title? Right now they appear to be ordered by date or ordered by title DESC but I don’t see an array in the loop to order.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Silkalns

    (@silkalns)

    This is not part of the theme but it can be done.

    Add this code to functions.php (preferably to Child theme functions.php )

    function sparkling_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', 'sparkling_modify_query_order' );
    Thread Starter svsdnb

    (@svsdnb)

    This worked perfectly! Than you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Order posts by title ASC’ is closed to new replies.