Home > Software design >  Word press title change
Word press title change

Time:10-07

I need to change the page title of https://ibros-dev.com/category/news/ this page I created this page from the category. So the page title is showing the category name. I need to change that page title to News. Already I checked there is no option to change the title. so need to change the title by using custom CSS. enter image description here

I check the coding of the page. enter image description here

Please help me change the page name to News instead of Category: News

CodePudding user response:

Place this code in your functions.php file

function change_category_page_title( $title ) {
    $title_arr = explode(':', $title);
    if ( count($title_arr) > 0 ){
        if(array_key_exists(1, $title_arr)) {
            return $title_arr[1];
        }
    }
    return $title;
}
add_filter( 'pre_get_document_title', 'change_category_page_title', 9999 );

CodePudding user response:

Try with this CSS

.category-news h1.page-title span {
   font-size: 42px;
} 
.category-news h1.page-title {
    font-size: 0;
}

Hope it works

  • Related