0

I would like to add a function to add for example a link in the top and in the bottom of all my pages. The best would be to create a plugin in order to activate or disable it.

Thank you so much.

5
  • To be more clear, I want to add a div at the top of each page/post/everything when the user will be logged. And I want to close the div and add other at the bottom of each page/post/everything
    – Mathieu
    Oct 31, 2013 at 15:42
  • Did you try the wp_head and wp_footer hooks ? Please add all that extra info into the question itself.
    – birgire
    Oct 31, 2013 at 15:43
  • Well, actually I don't know how to use it
    – Mathieu
    Oct 31, 2013 at 15:45
  • I would suggest searching this site and the WordPress Codex for examples. So much stuff has been written about these hooks ;-)
    – birgire
    Oct 31, 2013 at 15:49
  • I would rather use a different div class for logged in users if that's a possible solution?
    – birgire
    Oct 31, 2013 at 15:59

1 Answer 1

0

To do this you have to create a function in your plugin. To have it display only to logged in users use:

   if (is_user_logged_in()) {

then use the wp_head and wp_footer links to add actions to display the link you want, ie:

 add_action('wp_head','your_function');
 add_action('wp_footer', 'your_function');
1
  • Works like a charme
    – Mathieu
    Oct 31, 2013 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.