Display posts by alphabetical order

You can change the sort order on a category archive page to show posts by title (A-Z) by adding this code to your child theme’s functions.php: /* Sort posts by title for a specific category */ function change_category_order( $query ) { //Sort all posts from category with id=3 by title if($query->is_category(‘3’) && $query->is_main_query()){ $query->query_vars[‘orderby’] = … Read more

Reorder a page of posts of a certain taxonomy/value by a custom field

Well, I did it like this. Maybe it will help someone. add_filter( ‘pre_get_posts’, function () { global $wp_query; // article type – change posts per page. If webinars then change order to webinar_date if ( isset( $wp_query->query[‘article_type’] ) ) { set_query_var( ‘posts_per_page’, 12 ); if ( $wp_query->is_tax(‘article_type’, ‘webinar’) ) { $wp_query->set( ‘meta_key’, ‘webinar_date’ ); $wp_query->set( … Read more