How can i make active menu items switch to the first tab in Wordpress navigation Menus ? lets say i have 6 menu tabs. Menu1 menu 2 menu 3 menu 4 menu 5 menu 6 Code (markup): what I'm trying to accomplish is for example to bring menu 2 to the position where menu 1 is when menu 2 is selected . and so on for all the menu tabs .
I'm not entirely sure what you're trying to do, but if I understand you correctly, I highly advice you not to do it. It's gonna confuse your users no end. Users are stupid. They expect stuff to not move around - if they've found the "contact us" button, it should be where they found it, not moved to where "Home" was 2 seconds ago. Just my tip. However, this is a couple of lines of javascript. What kind of javascript depends on what library (if any) you're already using with your Wordpress-theme, and if you're currently not using any, which one you're willing to use. Example in jQuery (pseudocode): $('#mainmenu li').click(function(e) { $('#mainmenu').removeAttr('class','active'); $(this).addClass('active'); $('.active').insertAfter('#mainmenu'); } Code (markup): This counts on the menu being properly formatted as a list, having IDs, and loading of page-content via ajax - since page-reload will fuck this up. If you're loading pages the old-fashioned way, you'd need to redo the menu in the backend, which will be slightly harder, or base the rearranging on loading the window, and match some URL-attribute to a value on the item you want to move.
"Users are stupid." -- LOL. Yes, yes. The online world would be a better place if people sometimes remember this. It reminds me of the "clever" captchas that don't make sense to us mortals. The more stupid stuff you do to your site, the more people will just leave. Remember that!