Archived topic
Hook rules
1 reply · Started by Sebastien on June 26, 2019
Hi,
1)I try to make a hook directly into function.php file:
add_action( 'generate_after_header ','example_function_name' );
function example_function_name() { ?>
Insert your hook contents in here.
<?php }
I would like to add 2 rules :
- Location rule: Entire Site
- Exclusion rule: Front Page
2) Another solution I would like to be able to do is to add add Filter / hook to an existing GP Element Hook, by using the ID of the element. That would able me to keep using the GP UI to define rules and using php file to manage the content.. But I also wonder about speed performence of this case (compared to the first case)?
thanks for any help !
Hi there,
1. you would use WP conditional tags in your PHP:
https://docs.generatepress.com/article/using-hooks-conditional-tags/
2. I am not sure the reasoning for doing this, but i can't see that being possible. The display rules you set on an element are just including the necessary conditional tags for that content.