Home Forums Pro Themes Tourable Pro Remove the word Category from Category: Category Title on archive pages

This topic contains 3 replies, has 2 voices, and was last updated by  wensolutions 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #105542

    Hassan Christopher
    Participant

    Hello, I would like to change or remove “Category:” here to just be the Category Title. Alternatively, it would be ok to have it reflect the custom category base updated via permalink structures. In this case it would be the word “Show”. Please advise at your earliest convenience. Thanks!

    #105683

    wensolutions
    Keymaster

    Hello @hchtis,

    Thank you for using the theme.

    To remove the category you need to go through the child theme.

    After activating the child theme in your child theme functions.php file add below given code:

    function tourable_pro_child_custom_cat_title_removal ($title) {
    
        if ( is_category() ) {
    
                $title = single_cat_title( '', false );
    
            } elseif ( is_tag() ) {
    
                $title = single_tag_title( '', false );
    
            } elseif ( is_author() ) {
    
                $title = '<span class="vcard">' . get_the_author() . '</span>' ;
    
            } elseif ( is_archive() ) {
    
            	$title = preg_replace('/^\w+: /', '', $title);
    
            }
    
        return $title;
    
    }
    
    add_filter( 'get_the_archive_title', 'tourable_pro_child_custom_cat_title_removal);

    Hope this helps.

    Thank you

    #108647

    Hassan Christopher
    Participant

    Will this just remove the word “Category” or the whole “Category : Category Title” line. I just want to remove the “Category:” proceeding the category title. Is there a way to do this without activating and reconfiguring a child-theme?

    #108775

    wensolutions
    Keymaster

    Hello,

    The code we have provided above will remove the word “Category” not the whole “Category : Category Title” line. So, for this please add above given code in functions.php file of your child theme.

    If you have any queries further, let us know.

    Thank you.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.