How to Add Excerpts to WordPress Pages As Well As Posts
Many WordPress themes rely on “Excerpts” to show a short summary of your WordPress content.
You’ll find an “Excerpts” box on all your WordPress Posts, but you won’t find them on Pages. Excerpts on WordPress pages used to be a standard feature, then they were removed in WordPress 3.1.
Fortunately, if you need to use excerpts, it is easy to put the excerpt window back for “Pages”. All you need is a single line of code.
What are excerpts in WordPress?
If you’re unsure what excerpts are, check out this video from the PublishPress plugin:
Step #1: Locate your functions.php file
First, let’s find the WordPress file that we need to edit.
- Using an FTP Program or File Manager, go to /wp-content/themes/yourtheme/functions.php
- If there isn’t a functions.php file there, you can create a blank file and call it functions.php.
- If you are using a child theme, create a functions.php in the child theme’s directory.
The best choice is to use a child theme. This way when you upgrade your theme your changes won’t be overwritten. See this tutorial on creating a child theme if you need help.
Note: There is also a functions.php file in the wp-includes folder. Don’t use that one unless you are an expert PHP coder. That is a core file and only work on core files as a last resort – or never.
Step #2: Open the file for editing
- Open the functions.php file in a script editor.
- Scroll to the bottom .
- Find the last line.
- Paste the snippet and then save the file:
add_post_type_support( 'page', 'excerpt' );
Here’s how that code will appear inside your functions.php file:
Step #3. Create a New Page on Your WordPress site
Go to create a new Post. You’ll see the excerpt box on the editing page. If it’s not visible, Check the Screen Options and see if the correct checkbox is checked.
If you want to do more with your WordPress excerpts, check out this excerpts guide from PublishPress.
hi everyone this is working thanks to help me..
i am starting level wordpress developer
Thank you very mach!!!!!
Fantastic! Thanks for sharing this! Worked a treat.
Great! I needed excerpts in my theme’s “Team” items so I changed ‘page’ for ‘team’. Works perfect! Thank you so much!
Thank you very much, works! 😉
it’s work. Good
Glad to hear that 🙂
Thanks Steve, you saved me a long wait on the phone to Hostgator.
Excellent tutorial on how to add excerpts to wp pages. Thanks!