[wp-trac] [WordPress Trac] #40508: Add new do_action after load template files

WordPress Trac noreply at wordpress.org
Fri Apr 21 06:42:25 UTC 2017


#40508: Add new do_action after load template files
--------------------------+-----------------------------
 Reporter:  rajanit2000   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Could not perform action after get_header loads.

 get_header hook only perform before template part loads. So we can add new
 do_action after template files  loads

 '''
 do_action( 'get_header_after', $name );'''


 {{{
 function get_header( $name = null ) {
         /**
          * Fires before the header template file is loaded.
          *
          * The hook allows a specific header template file to be used in
 place of the
          * default header template file. If your file is called header-
 new.php,
          * you would specify the filename in the hook as get_header( 'new'
 ).
          *
          * @since 2.1.0
          * @since 2.8.0 $name parameter added.
          *
          * @param string|null $name Name of the specific header file to
 use. null for the default header.
          */
         do_action( 'get_header', $name );

         $templates = array();
         $name = (string) $name;
         if ( '' !== $name ) {
                 $templates[] = "header-{$name}.php";
         }

         $templates[] = 'header.php';

         locate_template( $templates, true );

         do_action( 'get_header_after', $name );
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40508>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list