The code in this download folder includes a template and custom functions to load the template on specific child category archives in Divi.
In this example, we change the featured image size, float the image to the left of the entry title and content as well as add a child category archive title & description, on 1 child category only.
Included are :
- A child theme to store your custom functions and templates which safely modify the the parent Divi theme without fear of losing customizations when the parent theme is updated.
- A custom child category template named
child-category.phpwhich includes all the default Divi code you can modify without effecting other parent & child category pages.
- A function to load the child-category.php template on 1 or more specific child categories only.
- A function to remove posts from child categories displaying on their parent category archive.
- A custom function named
divi_archive_title_description()which can be added to your child-category.php file to display your child category title & description added to the Edit Category screen for your child category.
Shows the child-category.php template file loaded on 1 specific child category with a modified thumbnail size displaying line with each posts entry title and content.
Tested using the Divi child theme by Elegant Themes in a custom child theme.
There’s 2 steps :
- # Install the child theme folder in your WordPress themes directory and activate if you have the Divi parent theme installed.
- # In divi-child > functions.php on line 12, change the number 22 to match the parent category ID for your child category.
You’ll need to change the class selector in the CSS ( lines 14 and 29 ) to match your child categories class which you can grab by inspecting the body classes.
Leave a Reply
You must be logged in to post a comment.