- This topic has 8 replies, 3 voices, and was last updated 2 years, 8 months ago by
Tom.
-
AuthorPosts
-
September 23, 2020 at 7:26 am #1455342
Nic
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:
screenshot shows split view. left side frontend and right side backend. Where do i change “BLOG”??
Site Infos in hidden field.
September 23, 2020 at 7:37 am #1455356David
StaffCustomer SupportHi 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.
September 24, 2020 at 12:50 am #1456451Nic
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?
September 24, 2020 at 2:48 am #1456620David
StaffCustomer Support“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.
September 24, 2020 at 3:10 am #1456648Nic
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.September 24, 2020 at 9:17 am #1457273Tom
Lead DeveloperLead DeveloperYou can do something like this:
add_filter( 'generate_page_hero_post_title', function( $title ) { if ( is_home() ) { $title = 'Your custom title'; } return $title; } );
September 25, 2020 at 3:25 am #1458212Nic
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.September 25, 2020 at 3:52 am #1458249Nic
alright, this seems to do the trick:
add_filter("generate_show_title",function(){ if(is_singular("post")) return true; return false; },100);
September 25, 2020 at 9:32 am #1458819Tom
Lead DeveloperLead DeveloperYea, we use that same filter to disable the main title if
{{post_title}}
is found. Glad you got it all working 🙂 -
AuthorPosts
- You must be logged in to reply to this topic.