Change navigation menu item position
This topic contains 8 replies, has 3 voices, and was last updated by Y A 11 years, 3 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: navbar, navigation, position
-
AuthorPosts
-
February 3, 2015 at 3:21 am #29628
Hi,
I would like to change the position of the items added by GDF.
For example, “Listings”, “Add Listing”, and “Change location”.Where can I edit the position of these items?
I understand that if I want to manually add an item at the end, I should set a very high position (https://wpgeodirectory.com/support/topic/add-menu-item-after-geodirectory-menu-items/).
However, when another plugin (i.e. Buddypress) adds a menu item, it appears before the GDF menu items.
I would like it to be in the following order:
Listings – Add listing – Change Location – Buddypress item – Custom itemThanks,
YAFebruary 3, 2015 at 4:55 pm #29749Hi YA,
You just have to play with the priority’s
first remove the items from their current priorit then re-add them, for example if u wanted to reverse the order of the default GD links and the locatiosn switcher
remove_filter('wp_nav_menu_items','geodir_menu_items', 100); add_filter('wp_nav_menu_items','geodir_menu_items', 50,2); remove_filter('wp_nav_menu_items','geodir_location_menu_items', 110); add_filter('wp_nav_menu_items','geodir_location_menu_items', 40, 2);Thanks,
Stiofan
February 3, 2015 at 6:23 pm #29766Hi,
let us know if we can set this as resolved.
ThanksFebruary 3, 2015 at 6:50 pm #29774Hi,
This indeed allows me to re-order GDF items (location_menu_items and menu_items).
I have tried setting the position at 1 or 40, but it still appears AFTER my normal menu-items (contact page, buddypress items).February 3, 2015 at 7:16 pm #29781ok to get both the GD items BEFORE the menu please remove the other bits of code and add this:
remove_filter('wp_nav_menu_items','geodir_menu_items', 100); add_filter('wp_nav_menu_items','geodir_menu_items_mycustom', 50,2); remove_filter('wp_nav_menu_items','geodir_location_menu_items', 110); add_filter('wp_nav_menu_items','geodir_location_menu_items_mycustom', 60, 2); function geodir_menu_items_mycustom($items, $args){ $location = $args->theme_location; $geodir_theme_location = get_option('geodir_theme_location_nav'); if ( has_nav_menu( $location )=='1' && is_array($geodir_theme_location) && in_array($location,$geodir_theme_location) ) { $items = geodir_add_nav_menu_items().$items; return $items; } else { return $items; } } function geodir_location_menu_items_mycustom($items, $args) { $location = $args->theme_location; $geodir_theme_location = get_option('geodir_theme_location_nav'); if ( has_nav_menu( $location )=='1' && is_array($geodir_theme_location) && in_array($location,$geodir_theme_location) ) { $items = add_nav_location_menu_items().$items; } return $items; }Thanks,
Stiofan
February 3, 2015 at 7:21 pm #29784Thanks boss.
That worked like a charm.Best,
YA
February 3, 2015 at 7:58 pm #29792Great! Feel free to leave us a review https://wordpress.org/support/view/plugin-reviews/geodirectory 🙂
Thanks,
Stiofan
February 3, 2015 at 9:39 pm #29825FYI, given that you are using Buddyrpess:
https://wpgeodirectory.com/support/topic/geodirectory-buddypress-integration-addon-beta-released/
Hope you like it! 🙂
February 3, 2015 at 11:12 pm #29843NICE. Thanks guys.
Will certainly leave a review.– YA
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket