Site logo

Archived topic

Can't change BLOG Title

8 replies · Started by Nic on September 23, 2020

Viewing posts 1–9 of 9

For some reason the Title "BLOG" on blog homepage can not be changed – what do i miss here?? normally it gets generated by the page title. but seems an exception here:
https://imgur.com/a/Fyt7kQJ

screenshot shows split view. left side frontend and right side backend. Where do i change "BLOG"??

Site Infos in hidden field.

Hi there,

are you using a Header Element to display the {{post_title}} ?
If so that won't work on the Blog page - you will need to create a separate Header Element and add your title within the element.

Make sure you exclude the Blog from your other Header Element.

yes indeed i use the delivered header element with <h1>{{post_title}}</h1>. still confuses me where "blog" comes from. DB entry contains "News" for this page id. Do you insert it by code?

"Blog" comes from the Hero element function.
As the WP blog does not have a 'content title' and does not parse any Meta box values we had two choices:

1. Don't output anything - which could lead the Element not displaying at all.
2. Auto add a commonly used title.

Either choice required the above steps to fix. The latter was less confusing to users and easier for us to diagnose and assist with a fix.

sorry but i don't agree. you can always get the title from the blog page by
get_the_title(get_option('page_for_posts'))
even outside the loop! just use the value if it is not empty.

You can do something like this:

add_filter( 'generate_page_hero_post_title', function( $title ) {
    if ( is_home() ) {
        $title = 'Your custom title';
    }

    return $title;
} );

alright this works for me:

add_filter( 'generate_page_hero_post_title', function( $title ) {
	if ( is_home() OR is_singular("post") ) {
		$title = get_the_title(get_option('page_for_posts'));
	}

	return $title;
} );

thanks for the hook!
another question regarding global header element: seems, if i put {{post_title}} in it, the default title of the current post disappears. if there is no {{post_title}} in the header element, the post title is appears again. how and where is this controlled? i need to exclude it for posts.

alright, this seems to do the trick:

add_filter("generate_show_title",function(){
    if(is_singular("post")) return true;
    return false;
},100);

Yea, we use that same filter to disable the main title if {{post_title}} is found. Glad you got it all working :)

This archived topic is closed to new replies.