WordPress.org

Ready to get started?Download WordPress

Forums

How to add drop down menu (23 posts)

  1. dtommy79
    Member
    Posted 3 years ago #

    Hi,

    I'm using the Universe theme from siteground, here is a demo:

    http://wordpress.siteground.com/universe/

    On the demo they have a nice drop down menu, but on the default install there isn't. Hover your mouse over the 'News' item)
    How can I add that drop down to my theme?

    Thanks

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

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

    /js/iSmallMenu.js

  3. dtommy79
    Member
    Posted 3 years ago #

    Yes, there is

  4. dtommy79
    Member
    Posted 3 years ago #

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

  5. govpatel
    Member
    Posted 3 years ago #

    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.

  6. dtommy79
    Member
    Posted 3 years ago #

    What do you mean by "adding it as primary location"

    Where do I do that?

  7. govpatel
    Member
    Posted 3 years ago #

    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.

  8. dtommy79
    Member
    Posted 3 years ago #

    Thanks.

    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.

  9. dtommy79
    Member
    Posted 3 years ago #

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

  10. govpatel
    Member
    Posted 3 years ago #

    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

  11. dtommy79
    Member
    Posted 3 years ago #

    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>
    	</div>
    	<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="http://www.dailydrummer.com/category/news/">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>
    
    		</ol>
    	</div>
    	<div class="m_bg">
    		<div class="main">
    			<div class="main_t_bg">
    				<div id="body">
  12. govpatel
    Member
    Posted 3 years ago #

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

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

  13. dtommy79
    Member
    Posted 3 years ago #

  14. govpatel
    Member
    Posted 3 years ago #

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

  15. dtommy79
    Member
    Posted 3 years ago #

    Thanks, it's working perfectly

  16. govpatel
    Member
    Posted 3 years ago #

    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

  17. shucker
    Member
    Posted 3 years ago #

    Hey there... I'm a latecomer with the same issue...

    First of all, thanks govpatel for the tips on getting the Custom Menu for this theme.

    Unfortunately, while this does work to enable custom menus, it doesn't seem to enable the dropdown menu. It didn't work for me and looking at the original poster's site (http://www.dailydrummer.com/) it isn't working for him either.

    Any idea as to why?

    Thanks!

  18. govpatel
    Member
    Posted 3 years ago #

    Did you drag the child slightly to right under parent in Custom Menus.

  19. shucker
    Member
    Posted 3 years ago #

    Yup. Tried turning on and off the parent attribute on the page as well.

  20. govpatel
    Member
    Posted 3 years ago #

    If you created a custom menu then you should be able arrange them from Appearance>>>Menus

    May be your theme does not have style for dropdown.

  21. shucker
    Member
    Posted 3 years ago #

    I can edit add/remove/edit menus under Appearance and have set a test subpage up and dragged it under and to the right of its parent. Dropdown just doesn't want to appear, so there's no way to access the subpage at all on the site.

    http://cleanslatestudios.ca/cofcof/

  22. govpatel
    Member
    Posted 3 years ago #

    I just checked the theme on siteground and seems as they have dropdown on the demo did you check if there are any theme options.

  23. shucker
    Member
    Posted 3 years ago #

    Yeah, the do have dropdowns, which is why the original poster and I are seeking out any assistance (no response from the company who created it).

    There aren't any "theme" options or misc plugins that haven't been activated. They just seem to have omitted it from the released theme. I'm looking through their source code to see if anything different stands out...

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.