- This topic has 13 replies, 6 voices, and was last updated 2 years, 8 months ago by Leo.
May 3, 2015 at 4:43 pm #105127Cassie Thomas
I have a GP Hook on my homepage that is currently housing a shortcode gallery right above my footer. Is there a way that I can mask this hook so it only shows on my homepage?
http://www.AmherstHall.comMay 3, 2015 at 10:55 pm #105190TomLead DeveloperLead Developer
Wrap it in a PHP if conditional:
<?php if ( is_front_page() ) : ?> Anything in here will only show up on the homepage. <?php endif; ?>
Make sure you check the “Execute PHP” checkbox.May 4, 2015 at 7:16 pm #105420Cassie Thomas
Great Thanks!May 4, 2015 at 11:35 pm #105495TomLead DeveloperLead DeveloperJune 7, 2016 at 7:38 am #199987Oliver
Thanks! Where do I find the “Execute PHP” checkbox in WordPress?June 7, 2016 at 7:45 am #199990Jamal
Did you add the code to GP hooks? If yes then you can find the execute php checkbox right beneath where you added the code.
Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.June 13, 2016 at 9:27 am #201589Oliver
Thanks for your answer!But doesenst although I clicked the “execute php buttom” I got the following error message:
Parse error: syntax error, unexpected ‘if’ (T_IF) in C:\wamp\www\wp-content\plugins\generate-hooks\functions\hooks.php(19) : eval()’d code on line 2
What should I do?
Thanks for your help
IvoJune 13, 2016 at 9:36 am #201593TomLead DeveloperLead DeveloperJune 13, 2016 at 12:25 pm #201663Oliver
It was my fault. I forgot to insert the link into the PHP Code.
It works. Great.
Thanks!June 13, 2016 at 1:09 pm #201679TomLead DeveloperLead DeveloperFebruary 22, 2018 at 3:57 am #502682Mildmac SA (ESA78960895)
What about the opposite? I want to show a shortcode included in a GPHook in all pages but home page. I mean, I don´t want to show the shortcode in the home, cause I am using a transparent header, but I want the shortcode appears in the rest of the siteFebruary 22, 2018 at 9:13 am #503005LeoStaffCustomer Support
See examples here: https://docs.generatepress.com/article/using-hooks-conditional-tags/February 22, 2018 at 12:00 pm #503139Mildmac SA (ESA78960895)
Thanks LeoFebruary 22, 2018 at 1:45 pm #503206
- You must be logged in to reply to this topic.