Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

custom hook

  • Hello,

    is it possible to creat a custom hook after the first block of the content?


  • Hi there,

    that depends what the first block of content is , and whether you want to manually insert the hook or dynamically insert the hook.

    For example:

    a. manually insert a hook using a shortcode

    this PHP Snippet:

    add_shortcode('portable_hook', function($atts){
            $atts = shortcode_atts( array(
                'hook_name' => 'no foo'
            ), $atts, 'portable_hook' );
    	return ob_get_clean();

    And you can add a shorcode like this to generate the hook and name it as you want:

    [portable_hook hook_name="my_custom_hook_name"]

    b. dynamically insert the hook into the content.
    see my reply here:

    That inserts a custom hook before the first H2 on a page.

    Let me know what you require.

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