Support » Plugins » Add an include after <body> with a plugin

  • Bruz



    I’d like to include a top-menu in several WP-Blogs and therefore it is necessary to include a single php-file just after the <body>-tag and a css-file in the header.

    I think this is easy for someone familiar with the hooks, but I’m not…

    So thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kwebble


    Why do you want to use hooks? Can’t you change your templates and put the needed include statements where you want them?



    I could – but I want to use it in 13 blogs with different themes and it should be possible to change the themes or even use a new one and still have the menu on the very top.



    Creating the plugin is not that difficult and by using the hook wp_head the CSS can be added to the <head>.

    The problem is that there is no default hook defined for the beginning of the <body>. And because it is not defined, themes don’t include a call to execute plugins at that point.

    That means that for a plugin to add HTML right after <body> you must also change the templates of each theme to include a call to something like:


    Here body_start is the name of a new hook you define.

    So it can be done with a plugin, but not without changing template files. And that’s just what you didn’t want.

    Perhaps someone else with a solution?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add an include after <body> with a plugin’ is closed to new replies.