Skip to content

Instantly share code, notes, and snippets.

@eri-trabiccolo
Created May 7, 2015 14:05
Show Gist options
  • Select an option

  • Save eri-trabiccolo/c16f72a8a508a5550d29 to your computer and use it in GitHub Desktop.

Select an option

Save eri-trabiccolo/c16f72a8a508a5550d29 to your computer and use it in GitHub Desktop.
Add socials in menu
add_action('template_redirect', 'socials_in_menu', 20);
function socials_in_menu(){
remove_action('__navbar', array(TC_header_main::$instance, 'tc_social_in_header'), 10);
add_filter( 'tc_social_header_block_class', '__return_empty_string', 20);
add_filter('wp_nav_menu_items', 'add_socials_to_menu', 10, 2);
function add_socials_to_menu($items, $args) {
// If this isn't the main navbar menu, do nothing
if( !($args->theme_location == 'main') )
return $items;
ob_start();
TC_header_main::$instance -> tc_social_in_header();
$socials = ob_get_contents();
if ( $socials ) ob_end_clean();
// On main menu: put styling around search and append it to the menu items
return $items . '<li class="my-nav-socials">' . $socials . '</li>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment