Archived topic
Triggering a GP Hook conditionally
3 replies · Started by Sal C on June 11, 2021
Hi,
I wanted to ask if it's possible for GP to load a specific JS script on a page only if the referrer URL contains a specific query string parameter.
I look forward to your reply.
Best regards
Hi there,
If you're hook has no Display Rules you can use this filter to set it to display:
https://docs.generatepress.com/article/generate_hook_element_display/
Here's a similar example where the condition checks for a certain string in the URL to set the display condition:
https://generatepress.com/forums/topic/feature-request-6/#post-1385716
Hi David,
Thank you for your help. Could you just clarify where that php code should be pasted?
Best regards
Hi there,
In can use one of the method introduced here to add PHP:
Adding PHP: https://docs.generatepress.com/article/adding-php/