Created
January 1, 2015 20:22
-
-
Save eri-trabiccolo/95e3fd22213dc5d6822a to your computer and use it in GitHub Desktop.
Wrap the header into a div.container. to make it as wide as #main-wrapper.container
This file contains 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
// header content wrapped | |
add_action('after_setup_theme', 'wrap_header'); | |
function wrap_header(){ | |
add_action('__header', 'tc_header_header_start', 0); | |
function tc_header_header_start(){ | |
echo '<div class="tc-header-container container">'; | |
} | |
add_action('__header', 'tc_header_header_end', 40); | |
function tc_header_header_end(){ | |
echo '</div>'; | |
} | |
// apply tc-header borders to our new container | |
add_filter('tc_user_options_style', 'my_header_style',11); | |
function my_header_style($style){ | |
$top_border = esc_attr(tc__f('__get_option', 'tc_top_border')); | |
if ( $top_border == 1 ){ | |
add_filter('my_header_top_border', function(){ | |
//we need the skin color! | |
$skin = esc_attr(tc__f('__get_option', 'tc_skin')); | |
$color = TC_init::$instance->skin_color_map[$skin]; | |
return array( | |
'border-top: 5px solid' . $color .';', | |
'border-top: none;' | |
); | |
}); | |
} | |
$tb_style = apply_filters('my_header_top_border', array('','')); | |
$style .= sprintf(' | |
.tc-no-sticky-header header.tc-header, | |
.tc-sticky-header.sticky-disabled header.tc-header{ | |
%2$s | |
border-bottom: none; | |
background: transparent; | |
}%3$s | |
.tc-no-sticky-header .tc-header-container, | |
.tc-sticky-header.sticky-disabled .tc-header-container{ | |
%1$s | |
border-bottom: 10px solid #e9eaee; | |
background: white; | |
}%3$s', | |
$tb_style[0], | |
$tb_style[1], | |
"\n" | |
); | |
return $style; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment