I am using theme Twenty Sixteen. I created a menu using categories, and when I click on one and end up on a category page that has a "Category : ..." title. I would like to remove that title so that only posts are displayed.
I found this similar post :
Remove "Category Archives: title" at the top of a category page
However, the theme files are not the same and I can't find a "category.php" file. Does anyone know where to find the line responsible for displaying that category title ?
I would greatly appreciate your help, thank you :)
-
Related: wordpress.stackexchange.com/questions/179585/…– Jesse NicklesCommented Feb 19 at 8:10
3 Answers
That title is coming from archive.php
file of TwentySixteen theme.
You can find a <header>
code section in that file.
What you can do, simply copy the archive.php
file as category.php
and then remove the following code section from category.php
file:
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
</header><!-- .page-header -->
In case you want to show only Category name as page title, then instead of removing the above code from category.php
file, just replace the the_archive_title
method with:
printf('<h1 class="page-title">%1$s</h1>', single_cat_title('', false));
To add to the previous answer, if you don't want to remove/add code to the PHP file, you can also add this via CSS to hide that section:
.category h1.page-title {
display: none;
}
You can add this to style.css or go to Customize > Additional CSS
-
-
This did not work for me. Maybe it depends on the theme? I use traveler-blog-lite.– MmMCommented Oct 11, 2019 at 13:57
To stop category title from displaying in the front end post. just follow below steps. Add this line to additional CSS
.cat-links { display: none; }
-
Please try and include some sort of explanation when you post an answer. Commented Jun 5, 2020 at 15:55