Created
January 23, 2019 04:07
-
-
Save Longkt/38dc63cbdc33ddc6fde4e997194626db to your computer and use it in GitHub Desktop.
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
add_action( 'init', 'add_my_custom_header' ); | |
function add_my_custom_header() { | |
remove_action( 'onepress_site_start', 'onepress_site_header' ); | |
add_action( 'onepress_site_start', 'custom_onepress_site_header' ); | |
} | |
function custom_onepress_site_header() { | |
$header_width = get_theme_mod( 'onepress_header_width', 'contained' ); | |
$is_disable_sticky = sanitize_text_field( get_theme_mod( 'onepress_sticky_header_disable' ) ); | |
$classes = array( | |
'site-header', | |
'header-' . $header_width, | |
); | |
if ( $is_disable_sticky != 1 ) { | |
$classes[] = 'is-sticky no-scroll'; | |
} else { | |
$classes[] = 'no-sticky no-scroll'; | |
} | |
$transparent = 'no-t'; | |
if ( onepress_is_transparent_header() ) { | |
$transparent = 'is-t'; | |
} | |
$classes[] = $transparent; | |
$pos = sanitize_text_field( get_theme_mod( 'onepress_header_position', 'top' ) ); | |
if ( $pos == 'below_hero' ) { | |
$classes[] = 'h-below-hero'; | |
} else { | |
$classes[] = 'h-on-top'; | |
} | |
?> | |
<header id="masthead" class="<?php echo esc_attr( join( ' ', $classes ) ); ?>" role="banner"> | |
<div class="container"> | |
<div class="site-branding"> | |
<?php | |
onepress_site_logo(); | |
?> | |
</div> | |
<div class="header-right-wrapper"> | |
<!-- Your Phone number here --> | |
<a href="tel:9135381556" style="float:right"><?php _e( 'Call Us', 'onepress' ); ?><span></span></a> | |
<!-- End Phone number --> | |
<a href="#0" id="nav-toggle"><?php _e( 'Menu', 'onepress' ); ?><span></span></a> | |
<nav id="site-navigation" class="main-navigation" role="navigation"> | |
<ul class="onepress-menu"> | |
<?php wp_nav_menu( | |
array( | |
'theme_location' => 'primary', | |
'container' => '', | |
'items_wrap' => '%3$s', | |
) | |
); ?> | |
</ul> | |
</nav> | |
<!-- #site-navigation --> | |
</div> | |
</div> | |
</header><!-- #masthead --> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment