How do I enable excerpts in the theme?Currently excerpts are only displayed on the search page but I would like to enable them on tag and category pages.
In TwentyThirteen, there are many files, their names're started with
Among them, except the first two, all the others are for different post types, and you can understand their usages from their names.
The 2nd one,
content-none.php is used to display apology texts, when there is no content found with a query. And the 1st one,
content.php is used in various display pages with two conditions, where:
is_search()— is to check whether it is the search result page
is_single()— is to check whether it is the post details page
If you open the
index.php, you will find a code:
<?php get_template_part( 'content', get_post_format() ); ?>
Here the template part (
content.php) is called.
So, to show excerpt in your front page or home page, you will need to modify
content.php. Like the
is_single(), there are several other checkers in WordPress:
is_home()— is to check whether it is the home page
is_front_page()— is to check whether it is the front-page
is_category()— is to check whether it is the category archive page
is_archive()— is to check whether it is the general archive page
is_tag()— is to check whether it is the tags archive page
- ...so on
And you may know that, to enable excerpt instead of full content, you will have to change the code
Yep, @Rarst said a very important thing that, if you make change into any public theme, the changes will be wiped out when a new update will take place. So, to put your modifications in place, you have to make a Child Theme on TwentyThirteen. A Child Theme is nothing but a new folder with a stylesheet. You can get that at: