WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Plugins» How to Add Excerpts to Your Pages in WordPress

How to Add Excerpts to Your Pages in WordPress

Last updated on February 19th, 2018 by Editorial Staff
32 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Add Excerpts to Your Pages in WordPress

Do you want to add excerpts to your WordPress pages? By default, excerpts in WordPress are only available for posts. In this article, we will show you how to add excerpts to your pages in WordPress.

How to add excerpts to your pages in WordPress

Why You May Want to Add Excerpts to Pages in WordPress?

WordPress comes with posts and pages as two default content types. Posts are displayed in reverse chronological order (latest to oldest) on your blog or homepage.

Pages on the other hand are stand alone content not published in a time specific order. They are typically used for one-off content like your about us or contact page.

Sometimes you may need to display excerpts for your pages. Specially if you have built a site using only pages.

Let’s take a look at how to add excerpts to your pages in WordPress as well as how to display those excerpts on your site.

Adding Excerpts to Pages in WordPress

First you need to add the following code to your theme’s functions.php file or a site-specific plugin.

add_post_type_support( 'page', 'excerpt' );

This code modifies the default WordPress content type ‘page’ to add support for excerpts.

You can head over to create a new page or edit an existing page. Below the post editor, you will be able to see the excerpt meta box.

Excerpt metabox on the page edit screen in WordPress

Now you can use this excerpt meta box to add custom excerpts for your pages in WordPress.

Displaying Excerpts for Pages in WordPress

There are many different ways to display excerpts for your pages in WordPress. Depending on what you are trying to do on your website, you can choose the method that best suits your need.

Method 1: Display Recent Pages With Excerpts Using Shortcode

This method allows you to create your own custom queries and display recent pages using a shortcode.

First you will need to install and activate the Display Posts Shortcode plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to edit the post, page, or widget where you want to display recent pages and add the following shortcode.

[display-posts post_type="page" include_excerpt="true" excerpt_more="Continue Reading" excerpt_more_link="true"]

This shortcode will display the 10 recent pages with their title, excerpt, and a continue reading link.

If you didn’t enter the custom excerpt for a page, then it will automatically generate the excerpt for the page with the default length of 55 words.

Display page excerpts

If you are using the shortcode in a sidebar widget, then you may need to enable shortcode support for text widget. Simply add this code in your theme’s functions.php file.

// Enable shortcodes in text widgets
add_filter('widget_text','do_shortcode');

Method 2: Display Page Excerpts in Sidebar Using Plugin

This method allows you to easily display recent pages and their excerpts in your theme’s sidebar.

First you need to install and activate the Ultimate Posts Widget. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Appearance » Widgets page and add the Ultimate Posts Widget to a sidebar. First you need to provide a title for the widget and then switch to the Display tab.

Display excerpt for pages in widget

Next, you need to select the ‘Show excerpt’ option and then switch to the filter tab.

On the filter tab, select ‘Page’ under the post types section and then click on the save button to store your settings.

Select page as post type

You can now visit your website to see the widget in action.

Method 3: Display Page Excerpts Manually

Another way to display page excerpts is by adding the code directly to your theme files. You can create a custom page template and add the following code as an starting point.

$args = array(
'post_type' => array( 'page' ),
'posts_per_page' => 10,
); 
// The Query
$the_query = new WP_Query( $args );

// The Loop
if ( $the_query->have_posts() ) {
	while ( $the_query->have_posts() ) {
		$the_query->the_post();
		echo '<h3>'. get_the_title() . '</h3>';
		the_excerpt();
	}
	/* Restore original Post Data */
	wp_reset_postdata();
} else {
	// no posts found
}

You will need to adjust the code to match your theme templates.

That’s all, we hope this article helped you learn how to add excerpts to your pages in WordPress. You may also want to see our guide on how to create custom WordPress layouts with Beaver Builder.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

32 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

36 Comments

Leave a Reply
  1. Jim Kernicky says:
    Dec 23, 2020 at 4:00 pm

    Easy as pie – thanks a lot for that!

    Reply
    • WPBeginner Support says:
      Dec 29, 2020 at 9:40 am

      You’re welcome :)

      Reply
  2. Jean-Louis says:
    Aug 17, 2019 at 12:45 pm

    It’s very helpful… Thank you so much!

    Reply
    • WPBeginner Support says:
      Aug 19, 2019 at 11:12 am

      Glad our article was helpful :)

      Reply
  3. Adam says:
    Oct 17, 2018 at 3:17 pm

    So, I can’t find the “excerpt” option under “screen options” on the post/page editing page. I added the code to my functions.php file and the option to include the ‘excerpts’ is still not showing up. It’s as if the excerpts function doesn’t even exist on my install of wordpress. I added the following code and nothing changed:
    add_post_type_support( ‘page’, ‘excerpt’ );

    Please help

    Reply
  4. Juan Manuel Linares says:
    Mar 16, 2018 at 2:46 pm

    Thanks so much, it also worked for me, just when I needed it!

    It would also be advisable that you suggest ppl to check Screen Options (as CTGIRL said), ’cause in my case it was hidden there ;)

    Thanks anyway!

    Reply
  5. Steve says:
    Feb 9, 2018 at 2:03 pm

    Is there a way to add an excerpt to an archive category page like with the code for pages? The following code worked great for pages. Wanting to add it to the category archive too.

    add_post_type_support( ‘page’, ‘excerpt’ );

    Reply
  6. Ruth Billheimer says:
    Dec 16, 2017 at 5:34 am

    Thank you so much! This is excellent and just what I was looking for.

    Reply
  7. Atilla says:
    Mar 19, 2017 at 12:58 am

    Thank you for the code!

    Reply
  8. Djong Timoer says:
    Nov 27, 2016 at 10:04 pm

    I works !!
    Thank you

    Do you have idea how to use in post types?

    Reply
  9. Manoj says:
    Jun 28, 2016 at 2:58 am

    Thanks for the code .But if i don’t write content in excerpt section , Excerpt is not retrieving from editior .

    Reply
  10. Amit kumar says:
    Dec 6, 2015 at 11:49 am

    how to separate post excerpt in box

    Reply
  11. Toure says:
    Jul 12, 2015 at 6:54 am

    How can it be added to a page template?

    Reply
  12. nad ray says:
    Jun 24, 2015 at 12:05 pm

    You should wrap the code in :

    …for it to work and not make your site break/display a blank page.

    Reply
  13. Reza says:
    Jun 9, 2015 at 7:52 am

    How can I add excerpts to the events? Can anyone please help?

    Reply
    • nad ray says:
      Jun 24, 2015 at 12:11 pm

      I would use the same code, but change page to events (line 3). If that does not work you need to find your events custom post type name and enter it instead of pages.

      Reply
  14. ctgirl says:
    Jan 21, 2015 at 4:07 am

    The code worked for me. Added it to functions.php, and the Excerpt field became available in Screen options. Thanks so much!

    Reply
  15. kapil says:
    Nov 12, 2014 at 6:50 am

    around 15 days ago, same above code work perfectly for me, but now it is not working, what may be the problem, can anyone help me ? above code doesn’t show excerpt place in admin panel for new website that I am developing right now.

    Reply
    • Firda says:
      Dec 1, 2014 at 12:09 am

      It’s working for me. Maybe the exceprt was hide by screen options?

      Reply
  16. João G. says:
    Sep 8, 2014 at 10:47 pm

    That’s amazing! I got a job to change the layout of a website which is running on WP and I would have to search for a function to get the content with “strip_tags” and reduce characters, but after “googling”, found your post. Great !!

    Reply
  17. Real name says:
    Apr 3, 2014 at 8:13 am

    Tank’s

    codex.wordpress.org/Function_Reference/add_post_type_support#Example

    Reply
  18. Julio says:
    Feb 12, 2014 at 3:05 pm

    Thanks! worked perfectly

    Reply
  19. Dave Andrew says:
    Nov 26, 2013 at 8:41 am

    Worked a treat. Thanks for the post.

    Reply
  20. Owen says:
    Nov 15, 2013 at 2:32 am

    Thanks your sharing :)

    Reply
  21. Lins says:
    Feb 22, 2013 at 4:15 pm

    Thanks, super-handy & works easily. :)

    Reply
  22. syndrael says:
    Oct 26, 2012 at 4:38 pm

    Thanks it works..

    Reply
  23. Alastair Barnett says:
    Oct 7, 2012 at 12:52 pm

    Hello,

    I posted the above code to my functions php. I now cannot access my website. Here is the message I receive:Parse error: syntax error, unexpected T_FUNCTION in /home/content/94/8738594/html/wp-content/themes/associate/functions.php on line 82

    Please tell me how I can access my website in order to delete this code. Thanks if you can help. I’ve just lost my website and in a bit of a panic. Website address: http://www.thewritingbutler.com
    AB

    Reply
    • Editorial Staff says:
      Oct 7, 2012 at 10:19 pm

      You pasted the code in a wrong place. Here is an article that you should consider before pasting any code from any website:

      https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

      You will have to use FTP to fix it.

      Reply
  24. WK says:
    Oct 6, 2012 at 9:09 am

    Added the code to my functions.php to enable excerpts on my pages.

    Worked perfectly, first time – thanks.

    W.

    Reply
  25. mebhuwan says:
    Apr 30, 2012 at 2:16 am

    Thank you for posting. Great Code. :)

    Reply
  26. mattrock says:
    Apr 9, 2012 at 4:52 pm

    A very handy function. Thanks for posting!

    Reply
  27. DanS says:
    Feb 19, 2012 at 3:50 pm

    Brilliant, thank you

    Reply
  28. softboxkid says:
    Oct 26, 2010 at 10:46 pm

    no need any plugins… just place this add_post_type_support( 'page', 'excerpt' );
    to your functions.php

    Reply
    • Editorial Staff says:
      Oct 27, 2010 at 4:03 am

      Thanks for adding this code. We will update the post soon.

      Reply
    • ghimeray says:
      Apr 11, 2016 at 2:48 am

      How to get this excerpt into the page?
      Tne Excerpt function is working well, but i’m not able to get the excerpt into the front page.

      Reply
    • adam says:
      Oct 17, 2018 at 3:18 pm

      This didn’t work for me. :( Still no excerpts option. Using default 2015 theme.

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
WP Mail SMTP logo
WP Mail SMTP
Fix WordPress email delivery issues. #1 SMTP plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2021 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2021)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2021)
    • SiteGround Reviews from 4464 Users & Our Experts (2021)
    • Bluehost Review from Real Users + Performance Stats (2021)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2021 – Step by Step Guide
Deals & Coupons (view all)
LiveChat logo
LiveChat Inc Coupon
Get a 30 day free trial and 30% OFF LiveChat, one of the best live chat service providers for WordPress users.
LearnDash
LearnDash Coupon
Get the lowest price on the best learning management system (LMS) plugin for WordPress.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).

Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
  • Growth Fund
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon
  • AIOSEO

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress Security by Sucuri.