Do you want to add short summaries to your pages in WordPress?
Excerpts are brief extracts from your content that act like descriptions or summaries. In WordPress, excerpts are usually for posts, but you can add them to pages too. This guide will show you how to do it step-by-step.
Why Add Excerpts to Pages in WordPress?
WordPress has two main content types: posts and pages. Posts are shown in reverse order by date, like blog entries, while pages are standalone content like an “About Us” page.
Excerpts help visitors quickly see what a page is about. This is useful if your site uses mostly pages. Excerpts make it easier for visitors to browse and find what they are looking for.
Here’s how you can add excerpts to your pages in WordPress and display them on your site.
How to Add Excerpts to Pages in WordPress
To enable page excerpts, you need to add some custom code to your theme’s functions.php file. However, a small error in the code can break your site, and you’d need to re-add the code if you switch themes or update them.
Instead, you can use the WPCode plugin. This plugin safely adds custom code to your site.
- Install and activate WPCode:
- Install the WPCode plugin from your WordPress dashboard. Follow detailed instructions if needed.
- Add a custom code snippet:
- Go to Code Snippets » + Add Snippet. Click ‘Use Snippet’ under ‘Add Your Custom Code (New Snippet)’.
- Name your snippet for identification and select ‘PHP Snippet’ from the dropdown.
- Add the following code in the ‘Code Preview’ box:
php
add_post_type_support( 'page', 'excerpt' );
- Scroll to the ‘Insertion’ section and choose ‘Auto Insert’. Activate the snippet by toggling the switch to ‘Active’ and save.
- Add excerpts to your pages:
- Open the page you want to add an excerpt to in the WordPress block editor.
- In the block panel on the right, expand the ‘Excerpt’ tab and add your excerpt.
- Click ‘Update’ or ‘Publish’ to save.
Repeat this for any pages where you want to add excerpts.
How to Display Page Excerpts in WordPress
Now that excerpts are added to your pages, you need to display them on your site. You can do this by adding a shortcode to a widget area or a page.
- Install and activate the Display Posts plugin:
- This plugin enables a shortcode to show recent pages with titles, excerpts, and a ‘continue reading’ link.
- Display excerpts on a page:
- Create a new page or edit an existing one.
- Add a Shortcode block and insert this shortcode:
php
[display-posts post_type="page" include_excerpt="true" excerpt_more="Continue Reading" excerpt_more_link="true"]
- Click ‘Update’ or ‘Publish’ to save.
- Display excerpts in the sidebar:
- Go to Appearance » Widgets.
- Add a Shortcode block to the sidebar and insert the same shortcode. Update to save.
- Display excerpts using the Full Site Editor:
- Go to Appearance » Editor.
- Choose the page where you want to display excerpts.
- Add a Shortcode block and insert the same shortcode. Save your changes.
Bonus: Display Post Excerpts in WordPress
It’s also useful to show post excerpts on your blog. By default, WordPress shows full-length posts on the homepage, archives, or blog pages. This can make browsing difficult for visitors.
To show post excerpts:
- Go to Appearance » Customize.
- Expand the ‘Blog’ tab and find the ‘Post Content’ section.
- Select ‘Excerpt’ to display post summaries instead of full content.
If your theme doesn’t support excerpts, you can add custom code or use a page builder like SeedProd.
Now you know how to add and display excerpts on your WordPress pages and posts, making your site more user-friendly and easier to navigate.