Archived topic
What is the function of GP _Hook beside adding css, js ?
3 replies · Started by Tran on July 21, 2017
As far as i know until now, the gp_hook function allow user to add js code, css, etc. But i see there're a lot of option in there: ( before content, after content, etc ). When we want to add js to specific page, we have to add this line <?php if ( is_page( 'my-page-slug' ) ) : ?>. So what is the point of so many options and what are those option ?.And when i add js or css3 i'll have to put it to wp_header or wp_footer ?. Thanks in advance.
Hi there,
The main usage of GP hooks is for user to hook/add specific content (HTML) into those area
js would normally go into wp_head. However hooks won't accept CSS. What you can do is to give the content classes in hooks and style it with CSS using Simple CSS/Additional CSS etc.
See complete info here:
https://docs.generatepress.com/article/hooks-overview/
http://demo.generatepress.com/hook-locations/
Let me know if this answers your question.
Thanks, Leo. I understand it now
No problem!