Support » Themes and Templates » How to add drop down menu

Viewing 15 replies - 1 through 15 (of 22 total)
  • Michael


    Forum Moderator

    seems to be javascript; is there none with the theme files?


    Yes, there is

    I guess I just don’t know what HTML code I should add

    since the demo has dropdown menu it must be supporting custom menu

    click on appearance menus and create a custom menu and add it as primary location and add your pages to menu and drag them and arrange them as you wish and save the menu.

    What do you mean by “adding it as primary location”

    Where do I do that?

    when you click on menus on top left hand there is box what does say in there do have a primary location with drop down menu or does it say that the theme does not support custom menu.


    It says:

    The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.

    Or is there a way to add them manually by editing the header template?

    You can try this but make sure you have backup of files that you going make changes just in case you have to go back to original.

    There are two changes you need to make in your files to have two custom menus than you will be able manage one for your top bar and one for side bar widget you use that in footer as well if you want.

    If you comfortable to add some code in files then open functions.php at very bottom on file before ?> copy and paste this

    add_action( 'init', 'register_my_menus' ); function register_my_menus() { register_nav_menus( array( 'menu-1' => __( 'Menu 1' ), 'menu-2' => __( 'Menu 2' ) ) ); }

    update the file now if you click on menus in appearance you will see that box has changed and you have Menu 1 and Menu 2 Now we need to put in place of what you have in header file open header.php

    look for this <ul id=”NaviBar”>(could be using some other ID for navigation) and take everything out in between and <?php ?> and

    copy paste this

    <?php wp_nav_menu( array( 'theme_location' => 'menu-1' ) ); ?>

    so you should have this

    <ul id=”NaviBar”> <?php wp_nav_menu( array( ‘theme_location’ => ‘menu-1’ ) ); ?>

    and update the file

    Now we need to create the menu Go in Appearance Menus enter name to your menu on box and click on create menu now if you do not see pages box on left click on screen options on top right hand corner tick what ever you want see on the page now you will see boxs.

    On left one of them is pages select the pages you want in menu and click add to menu you will see all pages on the right from here you can arrange your pages as you want by dragging To make child page you just drag the page slightly to right under the parent and if want grandchild than drag a page slightly to right of child.

    once you done the arranging save menu on the top box Theme locations in Menu 1 select your menu that you just created for top.

    You can create 2nd one same way and select that in Menu 2 and then you add that to your sidebar or footer by using custom menu widget give it Title and select Menu 2 from dropdown and save. Let me know if you do not understand any part and let me know if this worked for you.

    Let me know if this works

    Thanks for the reply.

    I have the first part, but I’m not sure about the template edit, I have this:

    <div id="wrapper">
    	<div id="header">
    		<div class="header_image">
    	<div id="navi">
    		<ol class="main_menu">
    			<li <?php if (is_home()){ echo 'class="f current_page_item"';}else{'class="f"';} ;?>><a href="<?php echo get_option('home'); ?>">Home</a></li>
    <li <?php if (is_home()){ echo 'class="f current_page_item"';}else{'class="f"';} ;?>><a href="">News</a></li>
    <li <?php if (is_home()){ echo 'class="f current_page_item"';}else{'class="f"';} ;?>><a href="http://#">Videos</a></li>
    <li <?php if (is_home()){ echo 'class="f current_page_item"';}else{'class="f"';} ;?>><a href="http://#">Drummers</a></li>
    	<div class="m_bg">
    		<div class="main">
    			<div class="main_t_bg">
    				<div id="body">

    Have you checked if you have two menus in that box.

    I need see your url so that I guide you on 2nd part.

    <li <?php if (is_home()){ echo ‘class=”f current_page_item”‘;}else{‘class=”f”‘;} ;?>>“>Home
    <li <?php if (is_home()){ echo ‘class=”f current_page_item”‘;}else{‘class=”f”‘;} ;?>>News
    <li <?php if (is_home()){ echo ‘class=”f current_page_item”‘;}else{‘class=”f”‘;} ;?>>Videos

    <li <?php if (is_home()){ echo ‘class=”f current_page_item”‘;}else{‘class=”f”‘;} ;?>>Drummers

    Keep a copy of this file before you make the change
    take that code out replace with
    <?php wp_nav_menu( array( ‘theme_location’ => ‘menu-1’ ) ); ?>

    Thanks, it’s working perfectly

    You welcome now when you create any pages you will have add them in menu in admin you can add posts,category same way if you want

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘How to add drop down menu’ is closed to new replies.