+91 9620 604 607 asif.bedif@gmail.com

Changing The Automatic Excerpt Length for Divi’s Standard Blog Page and Category Page

The default length of Divi’s blog post excerpts is 270 characters.

Changing the default excerpt length for your blog page and category page requires a modification to Divi’s index.php file.

Add a copy of the index.php file to your child theme. If you don’t have a child theme installed, your first task will be to create one.

Open the index.php file using your text editor and find the following snippet of code:

truncate_post( 270 );

Change the number “270” to whatever you want the character length of your excerpt to be. If you want the excerpt to have a character length of 470, replace the code with the following:

truncate_post( 470 );

Save your file and go check out your blog post page and/or category page to see the new excerpt length in place.

Changing the Length of Divi’s Blog Module Post Excerpts

If you are using the blog module for your blog page, changing the automatic excerpt length requires a modification of the main-modules.php file in Divi’s theme files.

Once again, the first step, (if you haven’t done it already) will be to create a child theme so that future updates to your theme won’t override your customizations. Once you have your child theme created and active on your site, you need to redefine and move the blog module code to the child theme. To do this, create a new folder in your child theme folder called “custom-modules”.

À propos de asifbedif

Généralement, on utilise un texte en faux latin (le texte ne veut rien dire, il a été modifié), le Lorem ipsum ou Lipsum, qui permet donc de faire office de texte d'attente. L'avantage de le mettre en latin est que l'opérateur sait au premier coup d'oeil que la page contenant ces lignes n'est pas valide, et surtout l'attention du client n'est pas dérangée par le contenu, il demeure concentré seulement sur l'aspect graphique.

Partager sur les réseaux sociaux
Main menu