Forked from jamesfosker/Custom Header | HTML Version
Last active
December 26, 2018 01:14
-
-
Save Mediatros/56ff2a7a5783e1d3ddcfc0c10d99918d to your computer and use it in GitHub Desktop.
DIVI Header Hook Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_divi_header() { | |
//Insert HTML here | |
} | |
add_action( 'et_html_main_header', 'custom_divi_header' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$logo = ( $user_logo = et_get_option( 'divi_logo' ) ) && '' != $user_logo | |
? $user_logo | |
: $template_directory_uri . '/images/logo.png'; | |
ob_start(); | |
?> | |
<div class="logo_container"> | |
<span class="logo_helper"></span> | |
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
<img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" data-height-percentage="<?php echo esc_attr( et_get_option( 'logo_height', '54' ) ); ?>" /> | |
</a> | |
</div> | |
<?php | |
$logo_container = ob_get_clean(); | |
/** | |
* Filters the HTML output for the logo container. | |
* | |
* @since ?? | |
* | |
* @param string $logo_container | |
*/ | |
echo apply_filters( 'et_html_logo_container', $logo_container ); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_divi_header() { | |
echo do_shortcode('[et_pb_section global_module="xxx"][/et_pb_section]'); // Change XXX to library items id (you can find the library item id when editing the library item if you look in the url bar you will see number after .mysite.com/wp-admin/post.php?post=xxx ) | |
} | |
add_action( 'et_html_main_header', 'custom_divi_header' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment