[Resolved] Custom Hook element

Home Forums Support [Resolved] Custom Hook element

Home Forums Support Custom Hook element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2069940
    Den

    Hi team,

    Actually, I want to know if there is a way where I can display the hook as per my choice.

    For example: I want to show the hook element after Paragraph 2

    Is it possible? If yes, then how?

    #2070012
    David
    Staff
    Customer Support

    Hi there,

    Action Hooks don’t exist inside the post content. As hooks have to be ‘baked’ into the template code.
    However you can create a Shortcode to output a Hook and in turn filter the_content to insert that shortcode.
    Very convuluted – and Ying provides the code for that here:

    https://generatepress.com/forums/topic/show-element-after-specific-paragraph/#post-2067989

    With that code added it will insert a hook after the 2nd paragraph of all posts.
    And in a GP Hook element you can select the Custom Hook and add: after_first_paragraph to the custom hook field.

    #2070118
    Den

    Thanks David. You guys are doing an amazing job.

    Have a good day.

    #2070202
    David
    Staff
    Customer Support

    Glad to be of help

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