How to insert Page Title in Header Builder

Hi,
is there a way to insert Page Title in the Header Builder? Maybe using some codes?

I already saw the post in General Forum How To Insert Page Title into Header with Header Builder, but I couldn’t understand how to use this way…

Thanks!

Hi there,

Thanks for writing in! Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

Thanks for understanding. Take care!

@skated

Install a child theme and insert the code from my post into functions.php
Then, whenever you want to display the title, just use [show_page_title]

Thank you for your help @yvrcon!

There’s a plan to create headline element that will pull title automatically. We will let you know once this available.

2 Likes

Thanks Lely!

I found on the internet this code, paste it in Editor > Functions.php of my Child theme and add the shortcode in a text element. It worked!

function myshortcode_title( ){
return get_the_title();
}
add_shortcode( 'page_title', 'myshortcode_title' );

Thanks for sharing your solution!

1 Like

Hi,
the solution I found worked perfectly 'till now that I’ve started working on my Blog page. I’ve found out that the title showed is the one of the last post, and not the Blog page title, as shown in the picture below.

The showed title should be “BLOG XinLab”… Do you know how to fix this little problem?

Thanks for your always precious help!

Hi There,

Could you please try following this code.

/* title to get the post title  */
function getPageTitle() {
  global $wp_query;
  return get_post_title($wp_query->post->ID);
}

/* Add shortcode */
add_shortcode('page_title', 'getPageTitle');

Hope that helps.

Hi,
unfortunately this code doesn’t work. It gives me this error:

How to fix this? Thanks!

(in the meanwhile, I put back the old code)

Hi There,

Can you clarify then why you need the blog title when you have it already on the right part:

Breadcrumbs is displaying Blog title already.

Yes, you’re right.

Now I’m thinking to use css code “display:none” to hide the title only on the Blog page. Do you know how to do this?
I tried setting a new class for the text (.page-title) and using it with also the Blog ID, but it doesn’t work. Maybe I get the wrong Blog ID. How can I get the right Blog page ID, and what is the right CSS code to use?

Thank you very much!

P.S. the link to the blog page: http://giacomodenanni.it/blog/

Hi There,

Please try with this CSS instead:

.blog .page-title {
    display: none;
}
1 Like