WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing DIV-Wrap (Navigation) (5 posts)

  1. melowa
    Member
    Posted 1 year ago #

    Hi everybody,

    I have a problem with removing the "div"-Wrap in my template.
    I don't know why it doesn't work:

    functions.php:

    if (!function_exists('my_template')):
    	function my_template() {
    		register_nav_menus(array(
    			'primary' => __('Primary Navigation', 'my_template'),
    		));
    	}
    endif;
    
    function template_nav_menu_args( $args = '' ) {
    	$args['show_home'] = true;
    	$args['container_class'] = false;
    	$args['container'] = "";
    	return $args;
    }
    add_filter( 'wp_nav_menu_args', 'template_nav_menu_args' );

    template:
    <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Try $args['container'] = false;

  3. melowa
    Member
    Posted 1 year ago #

    That doesn't work. =/

    I've tested:
    <?php wp_nav_menu( array( 'container' => '' ) ); ?>

    and
    <?php wp_nav_menu( array( 'container' => false ) ); ?>

    and that also doens't work.

  4. melowa
    Member
    Posted 1 year ago #

    Nobody can help me?

    Details:
    $args['show_home'] = true; works fine
    $args['container'] = ""; dont work
    $args['container'] = false; dont work

    How it is:

    <div class="menu">
    <ul>
    <li class="current_page_item">
    <a title="Home" href="">Home</a>
    </li>
    <li class="page_item page-item-2">
    <a href="">Sample-Page</a>
    </li>
    </ul>
    </div>

    How I want it:

    <ul>
    <li class="current_page_item">
    <a title="Home" href="">Home</a>
    
    <li class="page_item page-item-2">
    <a href="">Sample-Page</a>
    
    </ul>
  5. melowa
    Member
    Posted 1 year ago #

    Okay my fail, I had a typing error. -_-'

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags