By default the Divi Theme from Elegant Themes has your blog display the full article in the archive view. If you’d like to make it have the excerpt view on your Divi theme, here’s an easy AND FREE fix.
Hey y’all, I’m Kori Ashton. And it’s another WordPress Wednesday. Today I’m speaking to the Divi Nation. Those of you out there running WordPress, using the Divi theme from Elegant Themes. I’m gonna show you today, how to create an excerpt inside of your blog feed.
So right now, on my website I’m using the Divi theme. And you’re gonna see, as I’m on my blog page, you notice up here, I’m on my blog page, I’m going through, and it has the full article listed. Even though in the backend of my website I say only display the summary. It still extends the entire darn thing. And then there’s my next blog post, that extends the entire darn thing. So how do you create an excerpt, or the summary view, for the Divi theme? I’m gonna show you the code that you plug in right now.
Backup of your website in place, right now, before you go further
So the first thing that you wanna do, without hesitation, is to be absolutely certain that you have a backup of your website in place, right now, before you go further. So if you’re running on WP Engine or Liquid Web or any of these other amazing hosting companies out there, be certain that there’s a backup in place, the most recent version and that you know how to get to it, in case something breaks right now. Because we’re gonna go dabble in some PHP. Don’t get nervous though, you don’t have to know how to write code. I can help you, and we’re only going to change one word.
Best plan would be to have a child theme in place
Okay, now that you know for certain you have a backup and you know how to get to it, we can move forward. The best plan would be to have a child theme in place right now. So that when Divi sends an alert that there’s an update available for the theme, you’re able to click that update and this customization that we’re about to do, stays in place. However, in this particular tutorial I’m gonna show you just how to go in and do what we call, “Cowboy coding,” and get it done right now.
If you ever do click update for the theme, you’re gonna have to repeat this step. So, best practice would be to make a child theme. I’ll show you that in a follow-up video. For now, let’s go get this done.
Setting Up The Excerpt Option in Divi
Over here, under Appearance, you’re gonna click on theme editor. Jumping into this area, thankfully you have a backup in place, don’t get intimidated, because we really are just gonna go change one file, one word.
Over here on the right side, I want you to do a search for index.php. Click on that, that’s gonna open up one of the main files of your WordPress website. On this particular screen, you can do a command F, if you’re on a Mac, or do a search for the word “truncate”. And you’re looking for this, right here, truncate post 270. Now, by default, Divi says: else get the content, What we’re changing is the word “content.” We’re gonna change that, to the word “excerpt.” That’s it. Click update, we’ll jump back here to the front side of our website.
Notice that it has the full darn article. I’m gonna click refresh and you notice now, it’s got all of them beautifully stacked with the truncated version of the excerpt, all clickable, easily able to go into. And this is going to affect every single one of your archive, or your main category pages.
So if I were to go to favorite plugins, the same function is gonna be there now. Beautifully added in, truncating every single one of these excerpts. It’s exciting! It’s that easy! But remember, the moment you click update on your Divi theme it’s gonna revert back to the original content tag that was there, right? Get content. So, what I’m gonna ask you to do is follow up. I’m gonna do another video, I’ll put the link below, if you wanna do this for a permanent fix, I want you to make a child theme file for your index.php file. I’ll show you how to do that next time.
I hope you’re having a great WordPress Wednesday. If you like stuff like this, I have an entire playlist for the Divi theme on this channel. And, I produce videos like this every single Wednesday helping you improve your online marketing inside the world of WordPress. So be sure to subscribe, click the bells, so you get those notifications and I’ll see you next time. Bye, y’all!