Community Forums › Forums › Archived Forums › General Discussion › Theme support genesis-menus
Tagged: add_theme_support, genesis-menus
- This topic has 4 replies, 2 voices, and was last updated 9 years, 5 months ago by Brad Dalton.
-
AuthorPosts
-
November 6, 2014 at 11:50 am #130694Titanium CreativeMember
I am adding theme support for a new menu and am using the following code, which works BUT:
add_theme_support( 'genesis-menus',
array(
'primary' => __( 'Primary Navigation Menu', 'genesis' ),
'secondary' => __( 'Secondary Navigation Menu', 'genesis' ),
'doy' => __( 'DOY Navigation Menu', 'child-domain' )
)
);I would rather be able to add theme support for one menu without disrupting support for existing menus. Using the code below will add the new menu but will disengage the other two.
add_theme_support( 'genesis-menus',
array(
'doy' => __( 'DOY Navigation Menu', 'child-domain' )
)
);Is htere any way or any kind of pass through argument I can use to APPEND a single menu to teh support without having to list ALL of the menus of have a centralized menu support script?
thanks for any help
November 6, 2014 at 11:52 am #130699Brad DaltonParticipantNovember 6, 2014 at 12:34 pm #130704Titanium CreativeMemberBrad, that worked great except the when the second line places the menu, it isn't structurally the same as the original primary nav so I used this:
function ticr_do_doy_nav() { /** Do nothing if menu not supported */ //if ( ! genesis_nav_menu_supported( 'doy' ) ) //return; /** If menu is assigned to theme location, output */ if ( has_nav_menu( 'doy' ) ) { $args = array( 'theme_location' => 'doy', 'container' => '', 'menu_class' => genesis_get_option( 'nav_superfish' ) ? 'menu genesis-nav-menu menu-nav superfish' : 'menu genesis-nav-menu menu-nav', 'echo' => 0, ); $nav = wp_nav_menu( $args ); $nav_output = sprintf( '<nav class="nav-doy" itemtype="http://schema.org/SiteNavigationElement" itemscope="itemscope" role="navigation">%2$s%1$s%3$s</nav>', $nav, genesis_structural_wrap( 'nav', 'open', 0 ), genesis_structural_wrap( 'nav', 'close', 0 ) ); echo $nav_output; } }
Not sure what all of this does exaactly but your recommendation combined with this is giving me exactly what I am after.
I modified the first line to :
add_action('init', function() { register_nav_menu( 'doy', __( 'DOY Navigation Menu', 'child-domain' )); });
I've been using anonymous functions for things I will only use once. It simplifies the code and readability. Plus I don't have to invent a bunch of function names for one-offs.
THANKS!!
November 6, 2014 at 1:11 pm #130712Titanium CreativeMemberSo, what exactly does add_theme_support do for you? It obviously does "something" more than just this.
November 6, 2014 at 1:17 pm #130714Brad DaltonParticipantTry this http://codex.wordpress.org/Function_Reference/add_theme_support
My understanding is that it enables you to register and use functions which are already included/supported in the parent theme or WordPress in the child theme simply by adding one line of PHP to your functions file.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.