Site logo

[Support request] Custom Hook for location of Convert Kit Shortcode

Home Forums Support [Support request] Custom Hook for location of Convert Kit Shortcode

Home Forums Support Custom Hook for location of Convert Kit Shortcode

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2417100
    Kelsey

    Hi,

    I currently have a hook created that inserts my convert kit lead magnet at the bottom of all my blog posts. But I’d like to place it in the middle of my blog post. Say, after the 15th or 20th paragraph. I know how to do this with the “add inserter” plugin, but I’d like to accomplish this without activating another plugin. Is there a way to do this with a custom hook?

    Thanks,

    Kelsey

    https://thegoldenlamb.com/coffee/calories-in-a-skinny-vanilla-latte/

    #2417142
    Ying
    Staff
    Customer Support

    Hi Kelsey,

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

    Just change prefix_insert_after_paragraph( $inserted_hook, 6, $content) to prefix_insert_after_paragraph( $inserted_hook, 20, $content ), and change [portable_hook hook_name="after_sixth_paragraph"] to [portable_hook hook_name="after_20th_paragraph"].

    Then you can use a custom hook, enter the hook name after_20th_paragraph like this:
    https://www.screencast.com/t/ajwtnNi45fIv

    #2420409
    Kelsey

    Thanks, Ying. How does it know to use my convert kit form?

    #2420480
    Ying
    Staff
    Customer Support

    How does it know to use my convert kit form?

    Don’t you have a hook ( you meant the block element - hook or hook element, right?) with the convert kit currently? If so, you just need to change the hook name to custom hook > after_20th_paragraph.

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