Tagged: dynamic menu
-
AuthorPosts
-
December 10, 2015 at 12:11 pm #550292
Hello,
I use a plugin called WC Vendors to build a marketplace (several vendors on a Woocommerce foundation).
I need to be able to display a list of vendors in the menu.Guys at WC Vendors gave some code to be included in functions.php
But should I include in functions.php or functions-enfold.php ?
Thanks.Below the code itself.
/* BEGIN WC Vendors Pro */ add_filter( 'wp_nav_menu_items', 'wcv_vendors_menu', 10, 2 ); function wcv_vendors_menu ( $items, $args ) { if ($args->theme_location == 'primary') { $vendors = get_users( array( 'role' => 'vendor' ) ); $items .= '<li><a href="#">Vendors</a>'; $items .= '<ul class="sub-menu">'; foreach( $vendors as $vendor ) { $store_url = WCVendors_Pro_Vendor_Controller::get_vendor_store_url($vendor->ID); $store_id = WCVendors_Pro_Vendor_Controller::get_vendor_store_id( $vendor->ID ); $store_name = get_post_field( 'post_title', $store_id ); $items .= '<li><a href="'.$store_url.'">'.$store_name.'</a></li>'; } $items .= '</ul></li>'; } return $items; } /* END WC Vendors Pro */
- This topic was modified 9 years ago by nberdugo.
December 10, 2015 at 1:23 pm #550340Hey nberdugo!
You should add the code to functions.php file and to keep your changes update safe, please use a child theme
Regards,
YigitDecember 10, 2015 at 3:39 pm #550465Hello Yigit
Thanks very much, I just did that.
It does not work though.
The code is supposed to display a menu with the vendor stores (for all user whose role is “vendor”).Based on the way Enfold works, so you see what could be wrong with this code? The developers told me it might need to be adapted depending on how the theme is working…
December 10, 2015 at 9:54 pm #550736Hi!
The code seems to be OK, but you would need to consult the WC Vendor developers, for further assistance on the issue as the problem is not related to enfold.
Please let us know if you have any more questions regarding our theme.
Cheers!
BasilisDecember 10, 2015 at 9:56 pm #550740Yes, unfortunately their answer is : If it doesnt show up on your site, it’s a matter of you debugging how your theme handles the menus and sorting it out from there.
So the call to the menu is correct, right?
December 15, 2015 at 2:30 pm #553028Hey!
if the plugin’s author can’t help you, then you would need to hire a freelance developer to make this plugin compatible: http://kriesi.at/contact/customization
Best regards,
AndyAugust 28, 2016 at 1:14 pm #678621Hey nberdugo,
Did you ever got that issue fixed? i would like to know since I’m trying to do the same thing
regards,
August 30, 2016 at 3:25 pm #679504Hi,
Please try adding following shortcode into navigation field in Appearance > Menus
[wcv_vendorslist]
Best regards,
YigitSeptember 20, 2016 at 2:06 pm #689211normaly you can make a page with this shortcode:
[wcv_pro_vendorslist]
and add this page to the menue.
- This reply was modified 8 years, 3 months ago by tiefenschaerfe.
September 20, 2016 at 2:08 pm #689216 -
AuthorPosts
- You must be logged in to reply to this topic.