• Resolved adamsymo

    (@adamsymo)


    Hi,

    I am creating a website and using categories instead of a blogs page. However, when I categorise something the Klean theme adds a title on the page saying “Categorise: Blog”.
    I would like to remove the “Categories:” part, so could anyone advise?

    To view my website please visit: Polarismusic.co.uk

    Thanks in advance
    Symo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Symo,

    Add the following code at the end of your functions.php file-

    add_filter( 'get_the_archive_title', function ($title) {
    
        if ( is_category() ) {
    
                $title = single_cat_title( '', false );
    
            } 
    
        return $title;
    
    });

    It should remove the “Category: “.

    This works so thank you very much, although i feel the need to mention that editing the function.php file through the wordpress dashboard editor crashed the entire site, as a syntax error was unusually picked up with the if statement. Had to transfer the file to my workstation and edit it in my text editor for it to work and not crash the site.

    Not sure if this is an isolated issue but just warning others who may have the same issue.

    Thanks @louis_hw, this is actually the right way to edit stuff in your themes.
    Also, it is recommended that you create child themes instead of directly editing the theme files.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘categories’ is closed to new replies.