I have written articles on how to add sections that are saved in the Divi Library, to the top of your Archive and Single Post pages. A feature that is not currently available in Divi out of the box.

To accomplish this we had to create custom php files and add them to the child theme. These are the other tutorials.

 

Add a Divi Library Header Section to the Top of your Archive Pages

Add a Header Section & Fullwidth Category Menu to the Top of your Single Post Pages

 

In this tutorial I am going to show you how you can create a separate category.php file and add a Divi Page Builder Header Section & Category Title for your Category Archive pages.

View The Live Demo

 

To do this you will need a basic child theme and you will need to use either an ftp program such as FileZilla, or if your hosting company offers you access to the cPanel, you can use the File Manager.

Let’s Get Started

 

Creating the Category.php File

The first thing we are going to do is create aΒ category.php template and add it to your child theme. If you have never done this before, don’t worry. It is much easier than you think and you will be stoked once you do it for the first time.

 

1. Unzip your most recent Divi Theme file that you downloaded from Elegant Themes.

001

 

2. Open up the unzipped folder, find the index.php file, and make a copy of it.

015

 

3. Now rename the file and name it category.php

Add Section and Category Title to Category Pages

 

4. Good job. You just created the template file. Now you will need to upload it to the child theme you have already installed. If you have not installed a child theme you can learn more about them, and download a free one here:Β http://quiroz.co/the-ins-outs-of-child-themes-premium-divi-child-themes/

 

4a. If you use an FTP program like Filezilla or WinSCP, you can just drag and drop the file over to your child theme. This is what it will look like using WinSCP.

 

4b. If you prefer to use the cPanel File Manager, then you just open up the file manager and go to the child theme folder (/wp-content/themes/the_name_of_your_child_theme/) and upload the category.php file. This is what it will look like.

005

 

Awesome. Now that was not so hard was it? Let’s move on to the next step.

 

Creating the Archive Header Section

Now we are going to create a header section and save it in the Divi Library.

 

5. Go to your Divi Library and select Add New.

 

6. Give it a name and select “Section” for the Template Type and then select Submit.

 

 

7. Now go ahead and create the header section of your choice. In my example I added a dark background image to the section and added a Text Module for the headline and a Button Module for the Contact Us button.

 

This is what my example looks like

 

008

 

 

Inserting the Category Header Section into the PHP template

Now we are going to grab the header short code and insert it into the category.php page with a little php snippet.

 

8. The first thing you will need to do is go into your Divi Library and open up the saved layout.

 

9. Once you have the layout open, check out the url and you will see a sequence of characters and numbers. You are going to want to grab the numbers as we will need that for the next steps. For example in my case, the number sequence that I want to grab is 208085. This is the url: http://montereydev.com/demos/tophead001/wp-admin/post.php?post=208085&action=edit

 

10. Go to Appearance> Editor and on the right you will find the archive.php file we added to your child theme. Go ahead and open that up.

017

 

11. The first line of code should look like this.

 

Replace that line with this snippet. And then replace the number 26861 with the number you wrote down for your particular layout (see step 2)

 

Unfortunately my Syntax plugin does not know how to read the shortcode without messing up this page so you will have to write the code yourself or grab the snippet from this rich text format file.

So your category.php file should now look like this.

 

BOOM!!!! You have just injected a Divi Page Builder Section into your Archive pages.

 

Inserting the Category Title into the PHP template

Now we are going to grab the Category Title and insert it into the category.php page with a little php snippet.

 

9. While you have the category.php template open, find this line.

 

Just underneath that line you are going to insert this snippet

 

Unfortunately my Syntax plugin does not know how to read the shortcode without messing up this page so you will have to write the code yourself or grab the snippet from thisΒ txt file.

So your category.php file should now look like this.

 

Adding The Custom CSS

If you are working with a child theme you can go to Appearance>Editor and open your stylesheet. If not, go to Appearance>Divi Theme Options>Custom CSS (which is located at the bottom of the first tab in Theme Options)

Add this CSS

/*------------------------------------------------*/
/*--------------[GQ CATEGORY TITLES]--------------*/
/*------------------------------------------------*/

.blog-title {
	margin-bottom: 60px;}
hr.archive-line {
	width: 25%;
	float: left;
	border: 0;
	height: 4px;
	background-color: #2ea3f2;}

 

BOOM!!!! You have just injected a Divi Page Builder Section into your Category pages. Your page should now have the Divi Builder Header Section and Page Title with an underline.

 

 

Styling The Title and Underline

 

If you want to change the color,width and thickness of the underline, just change these rules.

 

Once you start playing around with this type of stuff you will find you can do all sorts of amazing stuff in Divi.

Have fun!


Well that’s all for now. I hope you find this article useful.


The following two tabs change content below.
Geno is an entrepreneur who has been designing websites since 1996. He also enjoys all things design, traveling, hanging out with friends, encouraging other believers, and experimenting with new technologies. When not doing any of the above, you can find Geno blogging or writing Divi customization tutorials here on Quiroz.co.

STAY RELEVANT | BE INFORMED | SIGN UP NOW

IT DOES NOT TAKE LONG TO GET LEFT BEHIND!

You have Successfully Subscribed!

Pin It on Pinterest