Archived topic
Hooking custom content after the comments section
3 replies · Started by Joona on April 12, 2017
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.
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 :)
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.
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/