Genesis framework applies filters to the wp_nav_menu(). What I want to do is 2 things.
1 change the menu class via a filter
2 add a menu id via a filter
Here is the function I am trying to add a filter to.
add_action( 'genesis_after_header', 'genesis_do_nav' ); /** * Echoes the "Primary Navigation" menu. * * The preferred option for creating menus is the Custom Menus feature in * WordPress. There is also a fallback to using the Genesis wrapper functions * for creating a menu of Pages, or a menu of Categories (maintained only for * backwards compatibility). * * Either output can be filtered via 'genesis_do_nav'. * * @since 1.0.0 * * @uses genesis_get_option() Get theme setting value * @uses genesis_nav() Use old-style Genesis Pages or Categories menu * @uses genesis_structural_wrap() Adds optional internal wrap divs */ function genesis_do_nav() { /** Do nothing if menu not supported */ if ( ! genesis_nav_menu_supported( 'primary' ) ) return; if ( genesis_get_option( 'nav' ) ) { if ( has_nav_menu( 'primary' ) ) { $args = array( 'theme_location' => 'primary', 'container' => '', 'menu_class' => genesis_get_option( 'nav_superfish' ) ? 'menu menu-primary superfish' : 'menu menu-primary', 'echo' => 0, ); $nav = wp_nav_menu( $args ); } elseif ( 'nav-menu' != genesis_get_option( 'nav_type', 'genesis-vestige' ) ) { $args = array( 'theme_location' => 'primary', 'menu_class' => genesis_get_option( 'nav_superfish' ) ? 'menu menu-primary superfish' : 'menu menu-primary', 'show_home' => genesis_get_option( 'nav_home', 'genesis-vestige' ), 'type' => genesis_get_option( 'nav_type', 'genesis-vestige' ), 'sort_column' => genesis_get_option( 'nav_pages_sort', 'genesis-vestige' ), 'orderby' => genesis_get_option( 'nav_categories_sort', 'genesis-vestige' ), 'depth' => genesis_get_option( 'nav_depth', 'genesis-vestige' ), 'exclude' => genesis_get_option( 'nav_exclude', 'genesis-vestige' ), 'include' => genesis_get_option( 'nav_include', 'genesis-vestige' ), 'echo' => false, ); $nav = genesis_nav( $args ); } $nav_output = sprintf( '%2$s%1$s%3$s', $nav, genesis_structural_wrap( 'nav', 'open', 0 ), genesis_structural_wrap( 'nav', 'close', 0 ) ); echo apply_filters( 'genesis_do_nav', $nav_output, $nav, $args ); } } I was initially trying to add_filter where I can modify the $args to change the class and add an id.
How do I go about doing this?
Here is my 'best guess'
function xyz_modify_nav($args) { $args = array( 'menu_class' => 'xyz', 'menu_id' => 'custom' ); } add_filter('genesis_do_nav', 'xyz_modify_nav',20);