[wp-trac] [WordPress Trac] #21953: add action after get_header

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 21 00:21:44 UTC 2012


#21953: add action after get_header
-----------------------------+---------------------------
 Reporter:  thomask          |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Bundled Theme
  Version:  trunk            |   Severity:  trivial
 Keywords:                   |
-----------------------------+---------------------------
 It is several time i came on this - i quite often need to print something
 after header, but before the actual content. Problem is, that every
 template looks like


 {{{
 get_header(); ?>

         <div id="primary" class="site-content">

 }}}

 but the start of the main content is at the end of header.php


 {{{
 ...
         <div id="main" class="wrapper">
 }}}



 the get_header function is quite "stupid", just calls an action BEFORE the
 header (for HTTP headers), but there is no action after it, nor filter to
 update returned header.

 That's the only only place in whole template structure, where i cannot add
 anything (and placing something above the content but bellow header is
 quite often), and i would have to

 a) change all templates (create child ones)

 b) or change (child) header.php template


 So the only was is to copy the header.php to child theme and add something
 after it, what is very ofter "too much" when i e.g. want to place there
 some banner, which I cant position using css because e.g. unknown height.
 And copying quite complex structure of header.php is also not ideal
 solution, as header part is very often diferent theme by theme and version
 by version.

 So best would be to add some action in header.php just after everything
 else before that <div id="main" class="wrapper">

 {{{
 ...
         </header><!-- #masthead -->
         <?php do_action( 'after_header' ); ?>
         <div id="main" class="wrapper">
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21953>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list