Skip to content

Instantly share code, notes, and snippets.

@scottnix
Created October 18, 2012 20:53
Show Gist options
  • Select an option

  • Save scottnix/3914654 to your computer and use it in GitHub Desktop.

Select an option

Save scottnix/3914654 to your computer and use it in GitHub Desktop.
Thematic change post order, blog and archive examples
// there are 2 seperate examples here, one is for the home/blog posts, the other is for archives
// change order of posts in the blog/home section or front page
// http://codex.wordpress.org/Function_Reference/query_posts
function childtheme_home_post_order() {
if ( is_home() || is_front_page() ) {
global $query_string;
query_posts($query_string . '&orderby=date&order=asc'); // example of order by date, starting oldest first
// query_posts($query_string . '&orderby=title&order=asc'); // example of order by title, starting a-z
}
}
add_action('thematic_abovecontent', 'childtheme_home_post_order');
// change order of posts in the archive sections
// http://codex.wordpress.org/Function_Reference/query_posts
function childtheme_archive_post_order() {
if ( is_search() || is_category() || is_tag() ) {
global $query_string;
query_posts($query_string . '&orderby=date&order=asc'); // example of order by date, starting oldest first
// query_posts($query_string . '&orderby=title&order=asc'); // example of order by title, starting a-z
}
}
add_action('thematic_abovecontent', 'childtheme_archive_post_order');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment