• Hi all
    I would like to add submenue(dropdown) for childpages on the main menue bar on my site.
    Various things I have tried all sorts without success.
    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • You might want to have a look at the new custom menu function and wp_nav_menu.

    in the new Theme of WordPress 3.x (twentyten)…
    1. Look at the “access” section in the header.php of twentyten.
    – Where you want your menu you put at least this :

    <div class="access">
      <?php wp_nav_menu(); ?>
    </div>

    2. Look at the css of twentyten (where the #access is styled) – copy to your own css-file and modyfy colors

    3. Into your functions.php put :
    <?php add_theme_support( 'menus' ); ?>

    That should get you started and from there you just have to modify colors and stuff.

    All the best
    anja

    Thread Starter noig

    (@noig)

    wearitwell
    Thanks!
    I have tried your suggestion though I got shut of with different errors and I came across this in the header php:

    <div id="menu">
    		<div class="menu-bottom">
    			<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'menu' => 'Primary Menu', 'fallback_cb' => 'default_nav_menu' , 'depth' => ($voidy_disable_submenus=="true" ? 1 : 3)) ); ?>
    			<div class="spacer" style="clear: both;"></div>

    Does this mean I cannot add a drop down menue to the Voidy theme?
    Somwhere in the attached code it says “voidy disable submenus=true”

    Hi noig,
    Just for you I have downloaded voidy and tried…

    So this is what you have to put in your header.php to make it work!

    <?php
    
    global $options, $option_values;
    
    foreach ($options as $value) {
    
    	if($value['id'] != "voidy_temp"){
    
    	    if (empty($option_values[ $value['id']])) {
    
    			$$value['id'] = $value['std'];
    
    		} else {
    
    			$$value['id'] = $option_values[ $value['id'] ]; 
    
    		}
    
    	}
    
    }
    
    ?><!DOCTYPE html>
    
    <html <?php language_attributes(); ?>>
    
    <head>
    
    	<meta charset="<?php bloginfo( 'charset' ); ?>" />
    
    	<title><?php wp_title( '|', true, 'right' ); ?><?php bloginfo('name'); ?></title>
    
    	<link type="text/css" rel="stylesheet" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />
    
    	<?php if ($voidy_favicon) { ?>
    
    		<link rel="shortcut icon" href="<?php echo $voidy_favicon; ?>" type="image/vnd.microsoft.icon" />
    
    		<link rel="icon" href="<?php echo $voidy_favicon; ?>" type="image/gif" />
    
    	<?php } add_theme_support( 'automatic-feed-links' ); ?>
    
    	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    
    	<?php wp_head(); ?>
    
    </head>
    
    <body <?php body_class(); ?>>
    
    <div id="header">
    
    	<div id="logo">
    
    		<div id="h1"><a href="<?php echo get_option('home'); ?>/">
    
    			<?php if ($voidy_logo) { 
    
    				echo "<img src='".$voidy_logo."' style='".$voidy_logo_style."' alt='".get_bloginfo('name')."' />";
    
    			} else { bloginfo('name'); } ?>
    
    		</a></div>
    
    		<div id="h2" class="description"><?php bloginfo('description'); ?></div>
    
    	</div>
    
    	<div id="header-icons">
    
    		<?php if ($voidy_hide_twitter == "true") { ?>
    
    			<div class="spacer"></div>
    
    		<?php }else{ ?>
    
    			<div class="twitter"><a href="https://twitter.com/<?php if ($voidy_twitter) {echo $voidy_twitter;} ?>">&nbsp;</a></div>
    
    		<?php } ?>
    
    		<?php if ($voidy_hide_rss == "true") { ?>
    
    			<div class="spacer"></div>
    
    		<?php }else{ ?>
    
    			<div class="rss"><a href="<?php if ($voidy_rss) {echo $voidy_rss;} else { echo get_bloginfo('rss_url'); } ?>">&nbsp;</a></div>
    
    		<?php } ?>
    
    	</div>
    
    	<div id="menu">
    
    		<div class="menu-bottom">
    
    		<ul>
    		   <?php wp_list_pages('sort_column=menu_order&title_li=' ); ?>
    		</ul>
    
    			<div class="spacer" style="clear: both;"></div>
    
    		</div>
    
    	</div>
    
    </div>

    To make it easier, I just put

    <ul>
    <?php wp_list_pages('sort_column=menu_order&title_li=' ); ?>
    </ul>

    instead of

    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'menu' => 'Primary Menu', 'fallback_cb' => 'default_nav_menu' , 'depth' => ($voidy_disable_submenus=="true" ? 1 : 3)) ); ?>

    in Line 109.

    This means – of course – that you can’t use custom menus anymore but I guess in your case you don’t need that anyway…

    IF you want to keep the custom menu function, you can also just put this instead of the original call:

    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'menu' => 'Primary Menu') ); ?>

    I removed the “disable submenus” and the Fallback-Option.

    Cheers
    Anja

    Thread Starter noig

    (@noig)

    Anja
    Thanks a million!
    Hmmm…. hab grade kurz auf deinem namen gekilckt und somit festgestellt dass meine zweite sprache (hauptsprache) dieselbe ist.
    I have added:

    <ul>
    <?php wp_list_pages('sort_column=menu_order&title_li=' ); ?>
    </ul>

    That worked fine. Afterwards I also tried to change to this:
    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'menu' => 'Primary Menu') ); ?>
    to see if the costum menue would work, it didn’t.
    I don’t mind not being able to have the costum menus as long as I could get the drop down menu to work.
    For this purpose I installed JQuery Drop Down Menue plugin with the hope it just works out of the box.
    I tried to add this code:
    <?php jquery_drop_down_menu(’about us’) ?>
    too the header php though all I got was lockouts.As I use CuteFtp the lockouts are not a problem as I can upload the original and overwrite.
    Still no joy.
    All I wanted is to have drop down menu for “about us” and possibly others at some later date.
    I have also uploaded a sreen dump of the theme header php’s and it is confusing to see that many. Have not seen this before.
    Once more, thank you for your time and patience.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘adding dropdown to main menue’ is closed to new replies.