How to Add Excerpts to Your Pages in WordPress?
In WordPress, excerpts are short summaries of a longer piece of content, typically used on blog pages, archives, or search results. While excerpts are most commonly associated with posts, you can also add them to pages to provide a brief overview without displaying the entire content. This can be useful for creating teasers, summaries, or introductory text on landing pages or other areas of your site. Here’s a guide on how to add excerpts to your pages in WordPress.
1. Enable Excerpts for Pages in WordPress with Code
By default, WordPress does not include an excerpt field for pages. To add this functionality, you may need to modify your theme’s code or use a plugin.
Enabling Excerpts for Pages with Code
Here’s how to enable excerpts for pages.
- Go to Appearance ⟶ Theme File Editor in your WordPress admin dashboard.
- Select the “functions.php” file to edit your theme’s functions file.
Add the following code snippet to the functions.php file:
function add_excerpts_to_pages() { add_post_type_support('page', 'excerpt'); }add_action('init', 'add_excerpts_to_pages');
After adding the code, click “Update File” to save your changes. This code snippet enables the excerpt field for pages, allowing you to add excerpts to WordPress pages just like you would with posts.
Enabling Excerpts for Pages with Plugins
If you’re uncomfortable editing theme files or want a simpler approach, you can use a plugin. “Advanced Excerpt” is a popular plugin that provides additional control over excerpts in WordPress. Here’s how to use it:
- Go to Plugins ⟶ Add New in your WordPress admin dashboard.
- Search for Advanced Excerpt.
- Click Install Now ⟶ Activate.
- After activating the plugin, go to Settings ⟶ Advanced Excerpt.
In the settings, you can configure various options for how excerpts are handled. This includes controlling excerpt length, adding a “read more” link, and choosing where to enable excerpts (posts, pages, custom post types).
2. How to Add Excerpts to WordPress Pages?
Once you’ve enabled excerpts for pages, you can add excerpts to individual pages:
- Go to “Pages” in your WordPress dashboard and select the page you want to edit.
- If you’re using the Block Editor (Gutenberg), you can find the excerpt field in the “Document” tab on the right sidebar. Scroll down to find the “Excerpt” section.
- If you’re using the Classic Editor, the excerpt field should appear below the main content editor.
Enter your desired excerpt or summary in the provided field. Make sure the excerpt is concise and effectively summarizes the page content.
Once you’ve added the excerpt, click “Update” or “Publish” to save your changes.
Learn: Best WordPress Plugins for Bloggers
3. How to Display Excerpts on Your WordPress Site?
To display excerpts for pages, you need to ensure your theme supports it. Common areas where excerpts might be displayed include archive pages, search results, or custom templates. If your theme doesn’t display excerpts for pages, you may need to edit the theme’s template files or use custom code to ensure excerpts are displayed where needed.
If you want to display excerpts on specific pages or areas of your site, you can edit the relevant template files. Here’s a simple example to display excerpts in an archive or page list:
- Identify the Template File to Edit: Depending on where you want to display excerpts, you might need to edit files like
archive.php
,page.php
, or custom template files. - Edit the Template File to Display Excerpts: Locate the section in the template file where the page content is displayed. Replace the
the_content()
function withthe_excerpt()
to display the excerpt instead of the full content.
the_excerpt();
After making the changes, save the file and test your site to ensure the excerpts are displayed correctly.
4. Customizing Excerpts for Better Presentation
To make the excerpts more visually appealing, you can customize them further. Consider the following:
- Add a “Read More” Link: You can add a “read more” link to encourage visitors to view the full content.
- Adjust Excerpt Length: If you’re using the Advanced Excerpt plugin or custom code, you can adjust the length of the excerpt to control how much content is displayed.
- Styling Excerpts: Use CSS to style excerpts for better presentation. You can adjust font size, color, and spacing to improve readability.
Read: Blogroll Links vs WordPress Menus: Which to Choose
Conclusion
Adding excerpts to your WordPress pages can be a useful way to create concise summaries, improve navigation, and enhance user experience.
By enabling excerpts for pages, adding them to individual pages, and ensuring they are displayed correctly on your site, you can leverage this feature to improve your site’s usability and presentation. Remember to consider the context in which excerpts are displayed and ensure they add value to your site’s content.