WordPress.org

Ready to get started?Download WordPress

Forums

wordpress 3 - custom menus (26 posts)

  1. Ronnie
    Member
    Posted 4 years ago #

    i've been so looking forward to taking advantage of the new custom menus function in the new release but now find that my theme doesn't nativey support it. aaaaaaaaaaaahhhhhh!!

    i've spent so much time on this theme i can't turn back, but still really really need the custom menus.

    my categories currently reside above my logo on the left hand side of the header, and the pages exist below.

    what i'm looking to have is a mixuture of pages and categories in each line so that it looks like this:

    top: home....videos.....articles.....about

    bottom: latest.....events.....connect.....evolve.....portal

    http://www.transformingscotland.com

    can ayone please offer some help or advice? it would be greatly appreciated as the site launch date is coming up soon and i'm so hoping to have this worked out having spent days on it already

  2. Ronnie
    Member
    Posted 4 years ago #

    ps - i'm using the amirra theme

  3. elfin
    Moderator
    Posted 4 years ago #

    does your theme support widgets? the menu's can also be added via a widget.

  4. Ronnie
    Member
    Posted 4 years ago #

    thanks, thats quite cool actually.. i need them however to be on the header

  5. elfin
    Moderator
    Posted 4 years ago #

    then you'll need to either add menu support, or a widgetable area to your theme.

  6. wpweaver
    Member
    Posted 4 years ago #

    Adding support for the new WP 3 menu takes very minimal effort for a theme developer - about 3 lines of code are involved, and perhaps a few CSS fixes.

    Suggest you write to the theme developer and ask them to add support for WP 3 custom menus.

  7. Ronnie
    Member
    Posted 4 years ago #

    thanks elfin

    thanks wp - i tried to get in contact with the developer but no joy, they don't make themselves contactable it seems

    is the required additional code generic? like would someone else here know what/where to add?

  8. JoeytheSquid
    Member
    Posted 4 years ago #

    There's virtually no documentation on the new menus and no resources I could find online so we're pretty much flying by the seat of our pants here. That said, the code to get the menu to register seems pretty straightforward. Something like this goes into functions.php:

    // navigation menu
    if (function_exists('register_nav_menu')) {
    register_nav_menu('primary', __('Menu''));
    }

    Then you insert something like the following into your header:

    <?php wp_nav_menu( array( 'container_class' => 'menu', 'theme_location' => 'primary' ) ); ?>

    As for the CSS styling, good luck. I can't find any reference on that at all and there's precious few themes to tear apart for better reference. In short my blank theme, which I use for my web design projects, now supports menus but they don't actually work. Oh well.

  9. JoeytheSquid
    Member
    Posted 4 years ago #

    There's virtually no documentation on the new menus and no resources I could find online so we're pretty much flying by the seat of our pants here. That said, the code to get the menu to register seems pretty straightforward. Something like this goes into functions.php:

    // navigation menu
    if (function_exists('register_nav_menu')) {
    register_nav_menu('primary', __('Menu''));
    }

    Then you insert something like the following into your header:

    <?php wp_nav_menu( array( 'container_class' => 'menu', 'theme_location' => 'primary' ) ); ?>

    As for the CSS styling, good luck. I can't find any reference on that at all and there's precious few themes to tear apart for better reference. In short my blank theme, which I use for my web design projects, now supports menus but they don't actually work. Oh well.

  10. chriscpi
    Member
    Posted 4 years ago #

    The links below helped get my theme support custom menus

    # http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

    # http://www.nkuttler.de/2010/06/08/wp_nav_menu-wordpress-3-0/

    These taken from - http://codex.wordpress.org/Function_Reference/wp_nav_menu

    Hope they are helpful for some of you'll.

    Cheers,
    Chris.

  11. Ronnie
    Member
    Posted 4 years ago #

    thanks joey i tried entering in the code you mention but i still get

    "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."

    thanks chris i followed up on the links and used the examples but still the same

    the codex one i can't follow as its over my head
    i'm not up on the coding

    i'm hoping for the 'custom menu's for dummies' quick fix

  12. Equal Web Creative
    Member
    Posted 4 years ago #

    All you should need in your theme functions.php file is:

    <?php
    function register_my_menu() {
    	register_nav_menu( );
    }
    ?>
  13. Ronnie
    Member
    Posted 4 years ago #

    thanks.. does it need to go anywhere specific within functions.php as i tried it but lost view of the site, just got a blank white page

  14. Equal Web Creative
    Member
    Posted 4 years ago #

    Not really. Put it right at the bottom after the final ?>

  15. Ronnie
    Member
    Posted 4 years ago #

    thanks, my page is no more white . . the menus though are still not registering.. still get "The current theme does not natively support menus....." within the 'theme locations' part of the menu page within wp-admin

  16. Equal Web Creative
    Member
    Posted 4 years ago #

    There was an extra space in my code above between the second brackets.

    Try this:

    register_nav_menu();

  17. Ronnie
    Member
    Posted 4 years ago #

    good spotting, thanks for your time
    i get the same message however

  18. Ronnie
    Member
    Posted 4 years ago #

    does anyone know of any plugins that may help?
    i've search and searched but haven't found any

  19. sbernado
    Member
    Posted 4 years ago #

    Hi Guys!

    I am just diggin' into the menus too, and am having the same issues as ronniesblog.

    However, I found Justin's article to be just what I needed to get this working. Check out his helpful and thorough post on this here:
    http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

    Specifically adding this code to the functions.php page:

    add_action( 'init', 'register_my_menus' );
    
    function register_my_menus() {
    	register_nav_menus(
    		array(
    			'primary-menu' => __( 'Primary Menu' ),
    			'secondary-menu' => __( 'Secondary Menu' ),
    			'tertiary-menu' => __( 'Tertiary Menu' )
    		)
    	);
    }

    So my final looks like this:

    <?php
    add_theme_support( 'nav-menus' );
    add_action( 'init', 'register_my_menus' );
    
    function register_my_menus() {
    	register_nav_menus(
    		array(
    			'primary-menu' => __( 'Primary Menu' ),
    			'secondary-menu' => __( 'Secondary Menu' ),
    			'tertiary-menu' => __( 'Tertiary Menu' )
    		)
    	);
    }
    ?>

    Hope that helps :)

  20. misspixelblip
    Member
    Posted 4 years ago #

    How do i put both 'Primary Menu' and 'Secondary Menu' in a horizontal meny under one another? I want no dropdown like in theme 2010. When i mark a menu item in primary i want secondary to show childs of the primary menu. Can't find info anywhere. Thanks for help.

  21. 1721media
    Member
    Posted 4 years ago #

    I've been able to get the menus to appear individually with this code in the header.php
    <?php wp_nav_menu( array( 'theme_location' => 'primary-menu' )); ?>

    or

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

    but I can't make a drop down menu. How should I tweak it so that the secondary-menu appear on hover?

  22. Max
    Member
    Posted 3 years ago #

    @1721media: assuming your menu is correctly setup in appearance|menu (ie., with a second level) the "drop down" functionality is a feature of your site styling and maybe some js.

    Read up on superfish and friends... but that is really outside the scope of this thread...

  23. tracyberna
    Member
    Posted 3 years ago #

    @1721media: assuming your menu is correctly setup in appearance|menu (ie., with a second level) the "drop down" functionality is a feature of your site styling and maybe some js.

    So what you're saying is that creating drop-down menus is handled exactly the way it was before the custom menu option, i.e., create that functionality yourself with CSS or JS, use a plugin, etc. THAT part is still work-intensive. Yes?

    I was hoping that part of the whole process would be handled by the Custom Menus too, but that may very well come later and besides, this new innovation is already an awesome work-saver. :)

  24. esmi
    Forum Moderator
    Posted 3 years ago #

    So what you're saying is that creating drop-down menus is handled exactly the way it was before the custom menu option, i.e., create that functionality yourself with CSS or JS, use a plugin, etc. THAT part is still work-intensive. Yes?

    Incorrect. Use wp_nav_menu with the default fallback of wp_page_menu and the dropdowns/flyouts can be handled using pure CSS.

  25. tracyberna
    Member
    Posted 3 years ago #

    @esmi: Yes, of course. But you still have to style/create the CSS functionality or grab it from whatever resource you use, yes? (I often save time by relying on Stu Nicholls' programming genius at cssplay.co.uk instead of slogging through things myself.)

    I had found the Shailan Dropdown Menu Widget to be pretty quick and easy - I was hoping I'd still be able to use it. Will that be the case, do you know? Will the usual widgets still work?

  26. esmi
    Forum Moderator
    Posted 3 years ago #

    You can still use whatever menu plugins you like but most (all?) won't work with custom menus. The usual widgets and template tags still work as per usual.

  27. jacflash1966
    Member
    Posted 3 years ago #

    ok everyone. I hope someone can help with this.
    i have worked out how to get my tertiary menu to appear on my blog pages only (which was my goal)
    however, i don't know how to make it look like my main nav menu (same look and feel. all menu items in a nice row rather than listed one below the other)
    is there a tutorial on this anywhere?
    thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.