There are literally hundreds of ways to customize your post order and the way that they are listed in “the loop” on your WordPress pages. You can change they way they’re displayed on your home page, post pages, paged pages, tag or category pages, search results page, or custom theme pages!
This post is part of my 30 WordPress Hacks in 30 Days series!
Most WordPress themes display full posts for the blog homepage. When WordPress shows your homepage it looks for a file called “home.php” in your theme directory – and if it doesn’t find that it uses “index.php” instead. Look for home.php in your theme directory, if it’s not there edit index.php using “Appearance->Editor” in your wordpress dashboard admin.
Look for the following line of code:
This is where “the loop” starts. A little further down you’ll find a line of code like this:
It may look a little different but you will find a line with the_content. Just change the_content to the_excerpt like this (and save), and your homepage will show excerpts instead of full posts. If you change the text “Read the rest of this entry…”, you can customize what it says at the end of the excerpt.
By default WordPress posts are displayed from newest to oldest. Let’s say you want them to be in reverse order from oldest to new. I need this recently for a page of lessons – and I wanted them to display from the first lesson to the last. All you have to do is add one line of code just before “the loop” like this:
Maybe you want to show more or less posts per page (the default is 10). You could use code like this before “the loop”:
Maybe you want to order your posts alphabetically – you could use code like this:
If you have an multi-author site you could use code like this to get posts for specific authors:
Remember that you can use this code in any wordpress theme page to change the order or display of posts, like your single.php, page.php, index.php, home.php, search.php, archive.php, etc.