0


I want to remove "Browsed By Категорија: ..." from my category pages, but I don't know how. Web site is: http://deks.org.rs/sanunis/
Theme is nisarg.
Thank you in advance.

1

Add to the style.css (http://deks.org.rs/sanunis/wp-content/themes/nisarg/style.css) of your theme the following:

.category h3.archive-page-title {
    display: none;
}
1

(Amended)

OPTION ONE: Use CSS to remove the archive page header

The CSS option shown by Kagg Design is easiest and quickest. However, to eliminate not just the title, but the margins set for the header section as well, you'll have to set .archive-page-header to display: none;, or apply something more complex.

Also, if you don't want to remove all types of archive headers, you'll have to narrow it to .category .archive-page-header.

So, adding

.category .archive-page-header {
    display: none;
}

to the Customizer Additional CSS might be the simplest and most easily reversible way to remove the header from category pages, although you could also just use Kagg Design's removal of h3.archive-page-title if you don't mind or if you actually like the extra space, or if perhaps you want to leave the archive descriptions alone that Nisarg also lets you use (see code below).

OPTION TWO: Adjust Nisarg's category template file

Nisarg handles category archives and all other archives in an archive.php file.

You could go to that file, and comment out the "the_archive_title()" function:

<header class="archive-page-header">
   <?php //commenting out the archive title code
         // the_archive_title( '<h3 class="archive-page-title">'.__( 'Browsed by', 'nisarg' ).'<br>', '</h3>' );
         the_archive_description( '<div class="taxonomy-description">', '</div>' )
   ?>
</header><!-- .page-header -->

Or - maybe even simpler, and removing the need to alter CSS to remove the title header fully, you could just delete whatever you don't want.

Note that doing so will remove title headers for all archive pages without their own separate template files - tag, date, taxonomy, author, archive-{post-type} - since Nisarg doesn't deploy specific ones for any of these.

You may not want to do that. If you don't, you'd either have to handle categories conditionally or you might simply copy archive.php as category.php, and delete or otherwise adjust the code there. Using the template hierarchy system, the installation would load category.php for category archive pages, and leave archive.php the same for other archives.

Doing these alterations properly, or in the maintainable WordPress way, would, of course, mean creating a child theme for the purpose, and adding the modified file there.

OPTION THREE: Filter the_archive_title()

the_archive_title that Nisarg uses is a core function or tag, and has a filter hook: apply_filters( 'get_the_archive_title', $title ).

So, in your (child theme) functions.php file, you could add something like

add_filter( 'get_the_archive_title', 'wpse_remove_cat_title' );

function wpse_remove_cat_title( $title ) {

    if ( is_category() ) {

        $title = '' ; // or return something else altogether if you like

    }  

    return $title;

}

However, you'd still have to add some CSS to clean up the extra margin space.

CONCLUSION

For a simple task like this one, I might go the CSS-only route, but the child theme methods offer additional customization options - for instance if you want to add your own custom heading. Adding a child theme might seem like an unnecessary complication, but, if you're going to be developing the installation further, you might as well do it now as later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.