By default, the Twenty Fourteen default theme for WordPress displays full content on all archives except on search results pages.
You can change this using 1 of 2 methods:
- You can remove the_content tag from the content.php file leaving the excerpt
- Or you can control the content limit by adding a custom function to filter the_content in your child themes functions file.
On top of this, i’ll also show you how to add a read more link after the excerpt and also after the content limit if you choose that solution.
Note: Its advisable to create a child theme to protect your modifications from being lost when the Twenty Fourteen parent theme updates.
1. Modify content.php File
The 1st solution requires you to copy over your content.php file to your child theme and change this line of the code on line 47 from this:
To this:
Now all your archive pages including your home, category, blog, tag and author archive pages will display the excerpt rather than the full content of each post.
You can then add your read more link using code like this in your child themes functions file:
And here’s an example of what your archives may look like using this method:
2. Filter the_content
The 2nd solution simply requires you to copy the PHP code from the view raw link in this Gist and paste it at the end of your child themes functions file.
Alternatively, you can use this code snippet if you want to add a read more link after the content.
And here’s an example of what your archives can look like using the 2nd method:
Note: Only use one of these 2 snippets and change or remove the conditional tag to suit your needs as this code only effects the home page and not other archive pages.
Was This Tutorial Helpful?