Hi,
Please let me know how to add a hook (html or php based) to a certain page...lets say...to a home page. I have added a hook successfully but that code snippet is displayed on all pages. How to limit the hook to be shown on just a home page?
Thanks,
Farhan
Adding a hook to a certain page
Started by
grahamd79
, May 07 2012 05:38 PM
4 replies to this topic
#1
Posted 07 May 2012 - 05:38 PM
#2
Posted 07 May 2012 - 06:42 PM
WordPress has built in template conditionals:
#3
Posted 08 May 2012 - 04:56 AM
Thanks for your reply, Actually following is the code i wrote for my hook: ---------- if (is_front_page()) { add_action('pagelines_before_main', 'banner_me'); function banner_me() { ?>
#4
Posted 08 May 2012 - 12:34 PM
The conditional should be inside your function like this:
#5
Posted 08 May 2012 - 05:47 PM
great...it worked...










