Site logo

Archived topic

Custom Hook for location of Convert Kit Shortcode

3 replies · Started by Kelsey on November 15, 2022

Viewing posts 1–4 of 4

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/

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

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

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.

This archived topic is closed to new replies.