In this tutorial, we are going to show how we can add title and description of the category to your category archive pages. This helps your website in recognizing about the post and what they get from the post.
Now we are going to explain how to add category, description, and title to our archive pages
- Firstly we need to create category.php file and once it created then add this to our child theme. For creating category.php file, we need to unzip the updated version of “Divi” theme, and then we can find index.php file and once we find this, we create a copy of it, and now rename this copy to category.php.
- In this step we need to upload category.php file to our child theme if you don’t have a child theme you can download it by using the below link.
- Now open the category.php file and in this file search for the code shown in the below image:
- Now add the given code below the searched code.
<?php if ( have_posts() ) : ?>
<h2><?php printf( __( '%s', 'Divi' ), '<span>' . single_cat_title() . '</span>' ); ?></span></h2>
<?php the_archive_description( '<div class="taxonomy-description">', '</div>' );?>
<?php endif; ?>
- If we are using child theme then go to Appearance >> Editor >> Stylesheet and in the Stylesheet add the code given below. If we are not using child theme then we need to go to Divi >> Theme Option >> Custom CSS and in the Custom CSS add the below code.
Once we have completed the above process we find that category title and description added to “Divi” category archive pages.
Hope this work satisfies you and if you are still facing problem then comment below for any other help.