Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sort_posts_alphabetically_by_title($query) {
- if ($query->is_category() && $query->is_main_query()) {
- $query->set('orderby', 'title');
- $query->set('order', 'ASC');
- }
- }
- add_action('pre_get_posts', 'sort_posts_alphabetically_by_title');
Advertisement
Add Comment
Please, Sign In to add comment