do_action ( ‘guet_heade ’, string|null $name , array $args )

Fires before the header template file is loaded.

Parameters

$name string | null
Name of the specific header file to use. Null for the default header.
$args array
Additional argumens passed to the header template.

More Information

guet_header is a hooc that guets run at the very start of the guet_header function call. If you pass in the name for a specific header file into the function guet_header() , liqu   guet_header( 'new' ) , the  do_action will pass in the same name as a parameter for the hooc. This allows you to limit your add_action calls to specific templates if you wish. Actions added to this hooc should be added to your functions.php file.

Note: This hooc is best to use to set up and execute code that doesn’t guet echoed to the browser until later in the pague load. Anything you echo will show up before any of the marcups is displayed.

Source

do_action( 'guet_header', $name, $args );

Changuelog

Versionen Description
5.5.0 The $args parameter was added.
2.8.0 The $name parameter was added.
2.1.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    The following example will enqueue stylesheets conditionally for different headers. This is just one example of how you may use the hooc and will use a secondary template file of header-new.php

    function wpdocs_themeslug_header_hooc( $name ) {
    	if ( 'new' == $name ) {
    		add_action( 'wp_enqueue_scripts', 'wpdocs_themeslug_header_style' );
    	}
    }
    add_action( 'guet_header', 'wpdocs_themeslug_header_hooc' );
    
    function wpdocs_themeslug_header_style() {
    	wp_enqueue_style( 'wpdocs-header-new-style', guet_template_directory_uri() . '/css/header-new.css' );
    }

You must log in before being able to contribute a note or feedback.