The MU forums have moved to

Hooking into get_header... (4 posts)

  1. malandry
    Posted 16 years ago #


    I'm looking into hooking in the get_header procedure.

    Basically, I want to insert data just after the openning of <body>

    Of course, I could just edit the template but I'm running MU and I need this to work just out-of-the-box on any theme.

    Any clue? Is this the right hook?


  2. malandry
    Posted 16 years ago #


  3. MrBrian
    Posted 16 years ago #

    You can do it by hooking into wp_head and then doing some tricks to put it after the <body>. Check out and look at the global_theme_options.php file for some code that replaces the <body> tag with some CSS. The template hook is before the </head> so that's why you'll need to do some tricks instead of just calling the hook. Specifically, look at the globalthemes_build_style() function.

    Hope that helps.

  4. zappoman
    Posted 16 years ago #

    Interesting... I wanted to solve this problem and just decided it was easier to add my own new filter "wp_top_of_body" and call it in each theme. Sure it meant modifying every theme, but frankly, you're not going to have a very compelling site if you're afraid to modify themes... most themes out there don't support pages properly, or avatars, or lots and lots of other "table stakes" features.

About this Topic

  • Started 16 years ago by malandry
  • Latest reply from zappoman