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

Home Forums Support [Resolved] Dynamically add page/post title using template tags in a hook

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

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1113583
    Stephen

    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

    #1113715
    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.

    #1113924
    Leo
    Staff
    Customer Support
    #1113935
    Stephen

    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?

    #1113940
    Leo
    Staff
    Customer Support
    #1113949
    Stephen

    Yes Resovlved

    #1114045
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

    #1121544
    Stephen

    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

    #1121646
    David
    Staff
    Customer Support

    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>

    #1121707
    Stephen

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

    #1121852
    David
    Staff
    Customer Support

    You’re welcome

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.