WCMp Core
Resolved
Viewing 1 reply thread
-
AuthorPosts
-
-
September 17, 2021 at 1:32 AM #127733Brigitte G.Participant
Hi,
I would like add a custom tab to stores pages as see here: https://multivendorx.com/support-forum/topic/vendor-store-page-tabs/
But this code dosen’t works for me, it is normal? No error, no tabs added, just nothing.
Have you an idea please?
Thank you so much in advance.Best regards.
-
September 17, 2021 at 5:43 PM #127752MVX Support NinjaKeymaster
Hi,
Kindly use below code to add new tab on vendor shop page -:function add_custom_store_data_tabs( $tabs, $store_id ) { global $WCMp; $store_id = wcmp_find_shop_page_vendor(); $vendor = get_wcmp_vendor($store_id); $userstore = $vendor->permalink; $tabs['newtab'] = array( 'id' => 'newtab', 'title' => __( 'New Tab', 'dc-woocommerce-multi-vendor' ), 'url' => wcmp_get_newtab_url( $store_id ), 'priority' => 1, ); return $tabs; } add_filter( 'wcmp_store_tabs', 'add_custom_store_data_tabs', 10, 2 ); function wcmp_get_newtab_url( $user_id ) { global $WCMp; if ( !$user_id ) { return ''; } $vendor = get_wcmp_vendor($user_id); $userstore = $vendor->permalink; return apply_filters( 'wcmp_get_seller_newtab_url', $userstore . 'newtab' ); } add_action('wcmp_init', 'after_wcmp_init_newtab'); function after_wcmp_init_newtab() { global $WCMp; if( !is_admin() ) { add_rewrite_rule( $WCMp->frontend->custom_store_url.'/([^/]+)/newtab?$', 'index.php?'.$WCMp->frontend->custom_store_url.'=$matches[1]&newtab=true', 'top' ); add_action('wcmp_vendor_shop_page_newtab_endpoint', 'newtab_endpoint_content', 10, 2); flush_rewrite_rules(); } } add_filter( 'wcmp_query_var_filter', 'wcmp_add_extra_tab' ); function wcmp_add_extra_tab($tabs){ $tabs = array( 'reviews', 'policies', 'newtab' ); return $tabs; } function newtab_endpoint_content() { ?> <div class="wocommerce" > <div id="newtab" > <div id="wcmp_vendor_newtab"> <h2>hii</h2> </div> </div> </div> <?php }
CopyRegards,
-
-
AuthorPosts
Viewing 1 reply thread
The topic ‘Add custom tab to Store frontpage’ is closed to new replies.