wp_nav_menu()
, add this argument: 'container' => false
For the <ul>
element, there's an argument called 'items_wrap'
. This will remove the ul: 'items_wrap' => '%3$s'
Otherwise this function will remove the div for you:
[php]
// Remove the DIV container from around WordPress menus
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
function my_wp_nav_menu_args( $args = '' ) {
$args['container'] = false;
return $args;
} // function
[/php]
[php][/php]Revisions
- August 1, 2012 @ 05:36:10 [Current Revision] by PeterLugg
- August 1, 2012 @ 05:32:16 by PeterLugg
Revision Differences
August 1, 2012 @ 05:32:16 | Current Revision | ||
---|---|---|---|
Content | |||
Added: Removing the wrapping div is easy. When you use <code>wp_ nav_menu()</code>, add this argument: <code>'container' => false</code> | |||
Added: For the <code>< ul></code> element, there's an argument called <code> 'items_wrap'</code>. This will remove the ul: 'items_wrap' => '%3$s' | |||
Added: Otherwise this function will remove the div for you: | |||
Deleted: | Added: [php] | ||
Added: // Remove the DIV container from around WordPress menus | |||
Added: add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); | |||
Added: function my_wp_nav_menu_args( $args = '' ) { | |||
Added: $args['container'] = false; | |||
Added: return $args; | |||
Added: } // function | |||
Added: [/php] | |||
Added: [php][/php] |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.