grahamd79 3 Report post Posted May 7, 2012 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
Simon 248 Report post Posted May 7, 2012 WordPress has built in template conditionals: http://codex.wordpress.org/Conditional_Tags Share this post Link to post Share on other sites
grahamd79 3 Report post Posted May 8, 2012 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 Simon 248 Report post Posted May 8, 2012 The conditional should be inside your function like this: http://paste.pagelines.com/3el Share this post Link to post Share on other sites grahamd79 3 Report post Posted May 8, 2012 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 Login via PageLines Signup To PageLines Sign in to follow this Followers 0
Simon 248 Report post Posted May 8, 2012 The conditional should be inside your function like this: http://paste.pagelines.com/3el Share this post Link to post Share on other sites
grahamd79 3 Report post Posted May 8, 2012 great...it worked... :) Share this post Link to post Share on other sites