Support » Plugins » Sort the posts on the tag-page alphabetically in twentysixteen

  • Resolved Hakkelaar

    (@hakkelaar)



    Dear folks,

    I have been searching and trying suggestions, but for the life of me I can’t figure out how to order the posts shown on the tag-page in twentysixteen. (With tag-page I mean the page a visitor sees when (s)he clicks on a tag).

    Google links to wordpress-forum-threads from dating back 8 years where folks refer to category.php. This file doesn’t exist in the new themes.

    For future problems I’d also like to know where WordPress does it’s database queries because I think all this is done ‘above’ theme-level.

Viewing 1 replies (of 1 total)
  • Never mind, pasting the following in functions.php DID work after all:

    function my_post_queries( $query ) {
    	// not an admin page and is the main query
    	if ( !is_admin() && $query->is_main_query() ) {
    		$query->set( 'posts_per_page', 5 );
    		$query->set( 'orderby', 'title' );
    		$query->set( 'order', 'ASC' );
    	}
    }
    add_action( 'pre_get_posts', 'my_post_queries' );
Viewing 1 replies (of 1 total)
  • The topic ‘Sort the posts on the tag-page alphabetically in twentysixteen’ is closed to new replies.