Skip to content

Instantly share code, notes, and snippets.

@eri-trabiccolo
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eri-trabiccolo/bc447c364dd27236b105 to your computer and use it in GitHub Desktop.
Save eri-trabiccolo/bc447c364dd27236b105 to your computer and use it in GitHub Desktop.
Change logo/navbar classes
add_filter('tc_navbar_wrapper_class', 'my_header_elements_class');
add_filter('tc_logo_class', 'my_header_elements_class', 15);
function my_header_elements_class($classes){
// remember replacements sum must be == 12 to have them side by side
// the default proportion is: logo 3 - navbar 9
$src_rep_classes = array(
//filter => array( search => replacement)
'tc_logo_class' => array(
'span3' => 'span5'
),
'tc_navbar_wrapper_class' => array(
'span9' => 'span7'
)
);
// new classes to add
$add_classes = array(
//filter => array of classes
'tc_navbar_wrapper_class' => array(
'grad-blue'
)
);
$current_filter = current_filter();
$new_classes = str_replace(array_keys($src_rep_classes[ $current_filter] ),
array_values($src_rep_classes[ $current_filter] ),
$classes);
return ( isset($add_classes[$current_filter]) ) ? array_merge( $new_classes, $add_classes[$current_filter] ) : $new_classes ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment