Site logo

[Support request] Trouble Adding Hook Element to Existing Single Post Content Element

Home Forums Support [Support request] Trouble Adding Hook Element to Existing Single Post Content Element

Home Forums Support Trouble Adding Hook Element to Existing Single Post Content Element

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2469956
    Myles

    I’m using the GP site “Explore” and noticed there is an existing Single Post Content Element.

    Within that Single Post Content Element is an author box. Below that, I want to add a Call To Action box.

    I know I can edit the already made Single Post Content Element to add another box below the author box, but I want to make the Call to Action box a separate hook element, so that I can decide which blog posts have both boxes (author and call to action) or just one box, the author box.

    I tried creating a hook element but I can’t find a hook name that will insert the element right after the author box that was created using the Single Post Content Element.

    Can you please assist?

    #2469964
    Leo
    Staff
    Customer Support

    Hi Myles,

    but I want to make the Call to Action box a separate hook element, so that I can decide which blog posts have both boxes (author and call to action) or just one box, the author box.

    This won’t work with the current Single Post Content element unfortunately – the template removes all existing hooks.

    I believe the best solution is to modify the Single Post Content to be Authorbox only:

    1. Remove the Dynamic Content block:
    https://www.screencast.com/t/FKG0lnvnv

    2. Duplicate the Container that holds the author box then drag it outside the container wrapper:
    https://www.screencast.com/t/TmsHRjJfBEm

    3. Now you can remove the Container with the previous content and left with just the author box:
    https://www.screencast.com/t/ksJWQPQc

    4. Change the Element Type to Hook and Hook name to after_entry_content:
    https://www.screencast.com/t/RJ6eqJJXH7Z

    5. Then change the element name.

    Then you can create a separate element using the same hook and control the order using priority:
    https://youtu.be/VdoWGOsvDMk

    Let me know if this helps 🙂

    #2470005
    Myles

    Thanks, Leo. I should have made a copy of that template before deleting it as I realized it would completely change the layout of blog posts.

    Is there any way to maintain the look of the single column blog post with a white background like in the GP Explore site without creating a template? I used Explore because I wanted that layout, but now it’s wiped out.

    #2470006
    Myles

    Also, just a follow up to my previous message, do you also have instructions on how to create the Single Post Content template that came with Explore?

    #2470022
    Fernando
    Customer Support

    Hi Myles,

    Unfortunately, we don’t have step-by-step instructions readily available to share to create that page.

    However, to answer your first question, it can be created without the use of a Block Element – Content Template.

    You’ll need to create the Block Elements first.

    Page Hero: https://docs.generatepress.com/article/block-element-page-hero/
    Author Box: https://www.youtube.com/watch?v=4x6CjGOyagc
    Post Navigation: https://docs.generatepress.com/article/block-element-post-navigation/

    You can then create a Layout Element for the Content Width. Reference: https://docs.generatepress.com/article/layout-element-overview/#content-1

    The idea is to limit the width so that the content is smaller like it is in “Explore”. You can also disable the sidebar through the Layout Element.

    Lastly, in Appearance > Customize > Colors, set the Background color to something off-white. Then, set the Content Background color to white.

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