Site logo

[Support request] Hooking custom content after the comments section

Home Forums Support [Support request] Hooking custom content after the comments section

Home Forums Support Hooking custom content after the comments section

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #304997
    Joona

    GeneratePress doesn’t seem to have a custom hook after the comments field. Is there a general WordPress hook I could use, and if so, how?

    I need to insert a YouTube video after the comments field on single blog posts.

    #305067
    Tom
    Lead Developer
    Lead Developer

    You should be able to use this hook: https://docs.generatepress.com/article/generate_after_main_content/

    Let me know if you need help with the function/conditional 🙂

    #305606
    Joona

    I was able to insert the code to the right place, but I still need to make it conditional so that the code is shown only on single posts.

    #305703
    Tom
    Lead Developer
    Lead Developer

    Something like this should do it:

    add_action( 'generate_after_main_content','tu_after_main_content' );  
    function tu_after_main_content() { 
        if ( ! is_single() ) { ?> 
            Your Youtube video here
        <?php }
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/

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