[Support request] Combining Page Header Element Template Tags with Elementor Template

Home Forums Support [Support request] Combining Page Header Element Template Tags with Elementor Template

Home Forums Support Combining Page Header Element Template Tags with Elementor Template

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #663750
    Marcus

    I ran across this post where David mentioned there was a way to integrate Page Header Element template tags within Elementor to take advantage of dynamic titles, etc. Here’s the post:
    https://generatepress.com/forums/topic/merged-header-elementor/#post-371139

    I was able to create a test Elementor template and add it within the GP Header Element using a shortcode no problem. However, when I tried to use a template tag within Elementor, the text is just rendered out as {{post_title}} instead of, say, the page/post title.

    Just looking for some pointers on how best to stick with my GP Page Header Element and templates tags, but sprinkle in some Elementor widgets or layouts… and make them dynamic where possible.

    Thank you!

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #663822
    Tom
    Lead Developer
    Lead Developer

    The template tags provided in Elements will only work if they exist within the Elements content. They won’t work inside Elementor unfortunately.

    You’d need to build a shortcode to display the title instead:

    add_shortcode( 'content_title', function() {
        return get_the_title();
    } );

    Then you’d use [content_title] in Elementor.

    #663830
    Marcus

    Thank you for the code and explanation Tom! I’ll give that a shot!

    #664482
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.