On the homepage or archive page of your WordPress site, there is a list of recent posts. And under each post there is a short description, called an excerpt.
The length of this short paragraph or excerpt is set by default by the theme. Today I will show you How to reduce paragraph length in homepage?
You know different themes have different structures. While some themes have an excerpts length setup option, many themes do not have an excerpts option.
Regardless of the structure of the theme, you can control the excerpts using this php code. You can keep the length as per your need or you can hide the entire excerpt if you want.
How to Reduce Paragraph Length in Homepage?
Download functions.php Code
Modify Downloaded Code
Using the code I have provided directly, your excerpt length will be 0. If you want to hide the entire excerpt, you can use this code directly.
Otherwise if you want to keep the word limit of the excerpt, then you need to modify the code. There is a “0” in the code, set your word limit instead of this “0”.
Backup Existing functions.php
Editing the function.php file is a bit dangerous. So edit carefully, backup the file if necessary.There are three methods for this –
- Full website backup,
- Download functions.php file from cPanel,
- Copy and save all code of functions.php from admin panel.
Placement of Modified code
- Login your WordPress admin panel,
- Click on the Theme File Editor option under Appearance section,
- Then open functions.php file,
- Paste the downloaded code below all codes,
- Update Changes.