Created
October 18, 2012 20:53
-
-
Save scottnix/3914654 to your computer and use it in GitHub Desktop.
Thematic change post order, blog and archive examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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