Skip to content

Instantly share code, notes, and snippets.

@Dianakc
Last active December 16, 2015 06:19
Show Gist options
  • Save Dianakc/1d611238a64afbb1b24c to your computer and use it in GitHub Desktop.
Save Dianakc/1d611238a64afbb1b24c to your computer and use it in GitHub Desktop.
Modifica a ordem dos posts na listagem
<?php
function sort_categories_by_title($x) {
if (is_category()) { //can set specific ones
$x->query_vars['orderby'] = 'title';
$x->query_vars['order'] = 'ASC';
}
}
add_action('pre_get_posts', 'sort_categories_by_title');
;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment