Archived topic
Hooks
3 replies · Started by Richard Bland on July 30, 2015
Hi Tom,
I'm building a site as we speak and want to add in some PHP code via the HOOKS add-on 'after header'. I've used this before to add in HTML code and has worked perfectly, but in this instance I'd like to only have the hook appear on the front page.
What I am thinking is to use the if home page statement PHP and then echo out my div container, which in turn contains all my bits and pieces.
If I insert some PHP into the hook via the admin dashboard, will this work? and do you happen to know how to write that if home page statement correctly? :-)
You can add PHP to the hooks, you just have to check the "Execute PHP" checkbox below the hook.
For the front page:
<?php if ( is_front_page() ) : ?>
Stuff in here will only show on the homepage
<?php endif; ?>
Let me know if you need more info :)
As always Tom, much appreciated and great stuff! F*ing genius comes to mind... :-)
Haha happy to help! :)
