WordPress.org

Ready to get started?Download WordPress

Forums

Coding question (16 posts)

  1. ncearly
    Member
    Posted 8 months ago #

    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

  2. Sandeep
    Member
    Posted 8 months ago #

  3. Andrew
    Forum Moderator
    Posted 8 months ago #

    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;
    }
  4. ncearly
    Member
    Posted 8 months ago #

    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.

  5. ncearly
    Member
    Posted 8 months ago #

    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.

  6. esmi
    Forum Moderator
    Posted 8 months ago #

    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) ); ?>

  7. ncearly
    Member
    Posted 8 months ago #

    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.

  8. esmi
    Forum Moderator
    Posted 8 months ago #

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

  9. ncearly
    Member
    Posted 8 months ago #

    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/

  10. esmi
    Forum Moderator
    Posted 8 months ago #

    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.

  11. ncearly
    Member
    Posted 8 months ago #

    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.

  12. esmi
    Forum Moderator
    Posted 8 months ago #

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

  13. ncearly
    Member
    Posted 8 months ago #

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

  14. ncearly
    Member
    Posted 8 months ago #

    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.

  15. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

    Why not use a theme that is supported here?

  16. ncearly
    Member
    Posted 8 months ago #

    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.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.