1. Support
  2. Knowledge Base
  3. FAQ
  4. How to add a custom excerpt in WordPress?
  1. Support
  2. Knowledge Base
  3. Tutorial
  4. How to add a custom excerpt in WordPress?

How to add a custom excerpt in WordPress?

Most of our Premium WordPress Themes display automatically generated excerpts on archives or within widgets like for example the popular “MH Custom Posts” widget. But in WordPress it is also possible to add a custom excerpt that will override the automatically generated excerpt and gives you full control over the text you want to show to your readers.

What are Excerpts in WordPress?

Excerpts are small summaries or teaser texts of the full post or page content that will give your readers a quick overview of what they can expect when reading the full article on your website. By default the WordPress themes by MH Themes will display automatically generated excerpts that will show the first xxx characters of your content including a “read more” link. These excerpts are generated via the WordPress function:

<?php the_excerpt(); ?>

How to change the Excerpt Length?

Most WordPress themes by MH Themes have options included to modify the length of the automatically generated excerpts in WordPress. In case you want to modify for example the excerpt length on archives, you’ll usually find an option in your WordPress dashboard under “Appearance => Customize => General Options”.

In addition, most of the custom widgets like for example “MH Custom Posts” or “MH Slider” widget also have options included to modify the excerpt length very easily. These options are located in the widget settings of each specific widget. You can manage the widgets in your WordPress dashboard under “Appearance => Widgets”.

How to add a Custom Excerpt?

But sometimes you might not be happy with an automatically generated excerpt or you just want to add your own custom excerpt. In that case there is an option integrated in WordPress to enable an additional field to enter custom excerpts. This field usually isn’t visible by default, but you can navigate to “Posts” in your WordPress dashboard and then edit a post or just create a new post.

Custom Excerpts
In WordPress you can easily enable an input field for custom excerpts

When you are on the edit post screen, you’ll see a small menu item “Screen Options” in the upper right corner of the screen. Please click on the button and it will open an options panel where you can just check the box “Excerpt”. When this is done, you’ll have an additional input field below the editor where you can add your custom excerpt. In case you have entered a custom excerpt, it will be used instead of the automatically generated excerpt and the predefined excerpt length will be ignored. So you can make your custom excerpts as long as you prefer.

How to add Custom Excerpts to Pages?

By default the custom excerpt feature in WordPress is only available for posts. But sometimes WordPress themes have already enabled excerpts for pages. In case your WordPress theme does not support excerpts for pages, you could enable this feature by adding this code to the file functions.php of your WordPress theme:

function my_add_excerpts_to_pages() {
     add_post_type_support('page', 'excerpt');
add_action('init', 'my_add_excerpts_to_pages');

As an alternative, you could enable excerpts for pages by using WordPress plugins like for example “Page Excerpt”. You can just install and activate the plugin and your WordPress theme should then also automatically support custom excerpts for pages.

Was this article helpful?

Related Articles

Stay in touch with us!

Join our newsletter and we let you know about new theme releases,
as well as important updates and discounts.