Site logo

Archived topic

Dynamically add page/post title using template tags in a hook

10 replies · Started by Stephen on December 24, 2019

Viewing posts 1–11 of 11

Hi there,

Question 1: I am trying to dynamically add page/post titles using template tags in a hook. When I add this code: <h3> {{post_title}} </h3> it just shows the actual code "{{post_title}}" on each page not the title. How do I dynamically display a page title?

Question 2: is there a way to add custom fields in GP without a plugin?

Thanks,
Stephen

By the way, I figured out Question 2. If anyone reading, you click the 3 dots > Options > 'Custom Fields' to enable. After refresh, the Custom Field boxes now show up at the bottom of the editor.

Thansk, that was helpful and now I am also wondering how to dynamically add a custom field to a hook using the custom field template tag {{custom_field.name}}. IS this possible?

Yes Resovlved

No problem :)

Hello,

I’ve noticed this does not work on the main blog posts page (/blog). The page title either shows nothing left of the hamburger menu or sometimes shows the blog title of the first blog post in the feed (not “Blog” which I want).

The hook is <h3> <?php the_title( ‘<h3>’, ‘</h3>’ ); ?> </h3> and it's place before_logo.

thanks,
Stephen

Hi there,

the Blog is not a standard post type and doesn't have the_title function itself thats why it grabs the very first post title on the page.

Edit this Hook and on display Rules exclude the Blog.
Then create a new Hook just for the Blog page and output the HTML directly eg. <h3>Blog</h3>

OK, thanks. Added another header element specifically for the blog page.

You're welcome

This archived topic is closed to new replies.