Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Last active February 16, 2018 15:27
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 gregoirenoyelle/bc803f4b2b834e31dc23bd4fa95fdf32 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/bc803f4b2b834e31dc23bd4fa95fdf32 to your computer and use it in GitHub Desktop.
<?php // Ne pas mettre les balises PHP
// A placer dans le fichier functions.php de votre thème
// Placer le troisième menu dans le thème Before header
function wp3_appel_troisieme_menu() {
// Fonction pour afficher et configurer le menu
wp_nav_menu( array(
'theme_location' => 'troisieme-menu',
'container' => 'nav',
'container_class' => 'nav-primary nav-top',
'menu_class' => 'menu genesis-nav-menu troisieme-menu',
'depth' => 0,
'items_wrap' => '<div class="wrap"><ul id="%1$s" class="%2$s">%3$s</ul></div>',
) );
} // FIN function wp3_appel_troisieme_menu()
add_action( 'genesis_before_header', 'wp3_appel_troisieme_menu' );
<?php // Ne pas mettre les balises PHP
// A placer dans le fichier functions.php de votre thème
// Ajouter un ID sur mesure dans Nav Primary
add_filter('genesis_attr_nav-primary', 'wp3_class_nav_primary');
function wp3_class_nav_primary($attributes) {
$attributes['ID'] = 'nav-primary-perso';
return $attributes;
}
// Changer la classe sur Nav Secondary
add_filter('genesis_attr_nav-secondary', 'wp3_class_nav_secondary');
function wp3_class_nav_secondary($attributes) {
$attributes['class'] = 'nav-primary';
return $attributes;
}
<?php // Ne pas mettre les balises PHP
// A placer dans le fichier functions.php de votre thème
// Ajouter un nouvel emplacement de menu
function wp3_troisieme_menu() {
register_nav_menu('troisieme-menu', 'Troisième Menu');
}
add_action( 'init', 'wp3_troisieme_menu' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment