• 0
Sign in to follow this  
Followers 0

Adding a hook to a certain page

Question

Posted · Report post

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

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

Posted · Report post

WordPress has built in template conditionals: http://codex.wordpress.org/Conditional_Tags

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

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() { ?>

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The conditional should be inside your function like this: http://paste.pagelines.com/3el

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

great...it worked... :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0