• Resolved adatfalo

    (@adatfalo)


    Hello!

    How can I change the source code to list the books by descending order (by date)? I realized that the new post go to the end of the list. Is it possible?

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author zookatron

    (@zookatron)

    You should be able to change the global ordering of the books to sort by date by adding the following snippet to your theme’s functions.php file:

    
    function mytheme_pre_get_posts($query) {
    	if($query->is_post_type_archive('mbt_book') or $query->is_tax('mbt_author') or $query->is_tax('mbt_genre') or $query->is_tax('mbt_tag')) {
    		$query->set('orderby', 'post_date');
    		$query->set('order', 'DESC');
    	}
    }
    add_action('pre_get_posts', 'mytheme_pre_get_posts', 50);
    
Viewing 1 replies (of 1 total)
  • The topic ‘Sorted by date (DESC)’ is closed to new replies.