• ncearly

    (@ncearlyaolcom)


    here is the code i’m running to use custom menus in my navbar. Where would i ad the depth command to make the pages drop down?

    //<?php wp_nav_menu( array( ‘container’ => ‘none’, ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’, ‘menu’ => get_post_meta( $post->ID, ‘MenuName’, true) ) ); ?>//

    and would my depth be set as such &depth=3

Viewing 15 replies - 1 through 15 (of 15 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Where would i ad the depth command to make the pages drop down?

    You may need to look at CSS as well, it may only need to be this simple:

    ul ul {
     display: none;
    }
    
    li:hover ul {
     display: block;
    }

    Thread Starter ncearly

    (@ncearlyaolcom)

    i have looked at the codex and i’ve tried adding the following line //’depth’=> 3// to the code in several places. This paticular theme allows for 4 as is accept i dont know in the line of code above where the //’depth’=> 3// arg would go. each place i put it i get a syntax error. Sorry i’m not a programmer so the codex doesnt totally make since to me yet. Especially the order of things.

    Thread Starter ncearly

    (@ncearlyaolcom)

    Here is what i’m trying. I keep getting syntax errors so i know it’s how i’m setting it up. I am not understanding the codex yet.

    //<?php wp_nav_menu( array( ‘container’ => ‘none’, ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’, ‘menu’ => get_post_meta, ( $post->ID, ‘MenuName’, true ‘depth’=>2)) ); ?>
    //
    it works great without placing the depth => value in so i know i’m placing the depth value incorrectly or in the wrong place.

    Try:
    <?php wp_nav_menu( array( 'container' => 'none', 'container_class' => 'menu-header', 'theme_location' => 'primary', 'menu' => get_post_meta, ( $post->ID, 'MenuName', true ), 'depth'=>2) ); ?>

    Thread Starter ncearly

    (@ncearlyaolcom)

    Parse error: syntax error, unexpected ‘,’ in /home/content/81/11938281/html/millenniumgaming.net/wp-content/themes/videogame/header-testheader.php on line 128
    is the result.

    <?php wp_nav_menu( array( 'container' => 'none', 'container_class' => 'menu-header', 'theme_location' => 'primary', 'menu' => get_post_meta( $post->ID, 'MenuName', true ), 'depth'=>2) ); ?>

    Thread Starter ncearly

    (@ncearlyaolcom)

    I copied and pasted that. No syntax error with it that way however the dropdown doesnt happen either. Just highlights the pages on the page. http://www.millenniumgaming.net/gaming-tips/

    WordPress doesn’t create the dropdown on the front end of your site. You have to format that using your theme’s CSS. All the code above does it tells WordPress to automatically show Page links up to 2 levels down when a custom menu is not applied.

    Thread Starter ncearly

    (@ncearlyaolcom)

    This bar was originally for categories. I’m using it for custom page menus of other pages selected. The bar above drops down to 4 levels. How do i edit the css so this will happen? Please forgive my stupidity im at best a novice with coding and probably leaning more toward a complete rookie.

    What theme are you using? Where did you download it from?

    Thread Starter ncearly

    (@ncearlyaolcom)

    This theme is one i got from ebay. It is the revolution lifestyle. Unfortunately the author no longer supports this theme.

    Thread Starter ncearly

    (@ncearlyaolcom)

    If i could find a way to make the nav bar get wider when there are more than one line of page links on it i wouldnt have to have the dropdown. As it is when i add more than one line of pages in my menu they only show when hovered over because the second or third line becomes white which is the text color. I dont know how to make the nav bar wider so i’m trying to do it this way.

    Why not use a theme that is supported here?

    Thread Starter ncearly

    (@ncearlyaolcom)

    Until the past few days i didnt understand what was and wasnt supported. I guess because i’ve already put a ton of work into this one.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Coding question’ is closed to new replies.