Community Forums › Forums › Archived Forums › Design Tips and Tricks › Primary Menu location
Tagged: custom, login, logout, menu, theme location
- This topic has 6 replies, 3 voices, and was last updated 9 years, 5 months ago by
ZachScr.
-
AuthorPosts
-
May 14, 2014 at 1:31 pm #105146
Saved by the Bell
MemberHello,
Sure hope this is an easy fix. I am using the Eleven40 Pro theme.
I meant to delete just one menu item and ended up deleting the entire menu. Now I understand how to remove just one item at a time but when I recreated the menu, named it and asked for it to go to the Primary Menu location (to the right of the banner), it is showing up under the banner instead. The theme shows the default for the Primary Menu location to the right of the banner. I like it there. How do I change this back?
Thanks,
Saved by the Bell
http://www.dancingwiththeson.com/May 14, 2014 at 2:59 pm #105154David Chu
ParticipantHi,
Many of the new hipster themes have the menu way up in the Header Right widget instead of the standard old spots. You don't even have to necessarily "assign" it, I think. Just do Appearance... Widgets. Look for Custom Menu and drag it into Header Right. Then click on Custom Menu, choose your menu, and Save.That should do it. If not, check your docs that they aimed you at when you bought the theme.
Cheers,
Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
May 14, 2014 at 5:19 pm #105177Saved by the Bell
MemberHey David,
Great! ... but now the menu is in both spots. I thought about deleting in the "Appearance/Menus" but this might delete everything again. However... if this is what I need to do... please advise.
Thanks!
Saved by the Bell
May 14, 2014 at 5:34 pm #105183David Chu
ParticipantCoolness!
Now I believe all you have to do is go to Appearance.... Menus, WAY up at the top Manage Locations, unselect your Primary one, and save!Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
May 14, 2014 at 7:06 pm #105196Saved by the Bell
MemberDave,
Oh man, this IS coolness and easier than I thought easy was! So glad to get your help!
Saved by the Bell
May 15, 2014 at 7:14 am #105280David Chu
ParticipantGreat! The WP menu system is now pretty nice. Even if you do delete a menu, it's not too bad to recreate, unless somebody wanted 100 pages in their menu or something. 🙂
Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
September 8, 2015 at 6:16 pm #164974ZachScr
MemberHi there,
Hopefully this is the right place to ask this:
I'm trying to add a Login|Logout button to my website's menu (parallax pro). I want the button to say "Logout" when the user is
logged in, and "login" when they're logged out. I've found a good way to do this by adding custom code to the functions.php file.The code that I'm adding looks like this:
//Add login/logout link to naviagation menu function add_login_out_item_to_menu( $items, $args ){ //change theme location with your them location name if( is_admin() || $args->theme_location != 'primary' ) return $items; $redirect = ( is_home() ) ? false : get_permalink(); if( is_user_logged_in( ) ) $link = '<a href="' . wp_logout_url( $redirect ) . '" title="' . __( 'Logout' ) .'">' . __( 'Logout' ) . '</a>'; else $link = '<a href="' . wp_login_url( $redirect ) . '" title="' . __( 'Login' ) .'">' . __( 'Login' ) . '</a>'; return $items.= '<li id="log-in-out-link" class="menu-item menu-type-link">'. $link . '</li>'; }add_filter( 'wp_nav_menu_items', 'add_login_out_item_to_menu', 50, 2 );
Thing is, it only seems to work when the custom menu I'm using is set to "primary navigation menu". Of course if I set it as the primary navigation menu, I end up with two menu locations as discussed earlier in this thread (and the login/out button is only appears on the primary one). So I'd like to add the menu item to the custom menu without making it a "primary navigation menu".
I think the issue is in the theme location line above but I'm not sure what to target instead of "primary".
Anyone have any ideas? I feel like I've tried everything.
-
AuthorPosts
- The topic ‘Primary Menu location’ is closed to new replies.