Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Add two new tabs to display custom post type
Tagged: tab; custom post type
- This topic has 1 reply, 2 voices, and was last updated 4 years, 7 months ago by Sushobhan.
Viewing 1 reply thread
- AuthorPosts
- May 20, 2020 at 4:15 am #133314ceo3Participant
Create a snippet with this code to add a new image to the custom post type “artists”. I’ve already made changes to the code, but we only show products.
I took this source code to add a new tab here in the forum.
I need to add two custom tabs, one for the “artists” cpt and one for the “exhibitions” cpt.
I appreciate your help to resolve.
add_filter( 'wcfmmp_store_tabs', 'custom_wcfmmp_store_tabs2',90,2); function custom_wcfmmp_store_tabs2($store_tabs, $vendor_id) { $store_tabs['newtab'] = __( 'Artistas', 'wc-multivendor-marketplace' ); return $store_tabs; } add_filter( 'wcfmp_store_default_query_vars', 'wcfm_store_events_default_query_var2' ); function wcfm_store_events_default_query_var2( $query_var ) { global $WCFM, $WCFMmp; if ( get_query_var( 'newtab' ) ) { $query_var = 'newtab'; } return $query_var; } add_filter( 'wcfmp_store_tabs_url', 'new_wcfmp_store_tabs_url2',10,2); function new_wcfmp_store_tabs_url2($store_tab_url, $tab) { switch( $tab ) { case 'newtab': $store_tab_url = $store_tab_url.'newtab'; break; } return $store_tab_url; } add_action( 'wcfmmp_rewrite_rules_loaded', 'new_register_rule2', 8 ); function new_register_rule2($wcfm_store_url) { global $WCFM, $WCFMmp; add_rewrite_rule( $wcfm_store_url.'/([^/]+)/'.$WCFMmp->wcfmmp_rewrite->store_endpoint('newtab').'?$', 'index.php?post_type=artistas&'.$wcfm_store_url.'=$matches[1]&'.$WCFMmp->wcfmmp_rewrite->store_endpoint('newtab').'=true', 'top' ); add_rewrite_rule( $wcfm_store_url.'/([^/]+)/'.$WCFMmp->wcfmmp_rewrite->store_endpoint('newtab').'/page/?([0-9]{1,})/?$', 'index.php?post_type=artistas&'.$wcfm_store_url.'=$matches[1]&paged=$matches[2]&'.$WCFMmp->wcfmmp_rewrite->store_endpoint('newtab').'=true', 'top' ); } function wcfm_vendor_profile_custom_endpoint2() { global $WCFM, $WCFMmp,$WCFMu; $wcfm_store_url = get_option( 'wcfm_store_url', 'store' ); add_rewrite_endpoint( 'newtab', EP_ROOT | EP_PAGES ); } add_action( 'init', 'wcfm_vendor_profile_custom_endpoint2',12 );
- May 20, 2020 at 11:20 am #133416SushobhanKeymaster
Duplicate topic- https://wclovers.com/forums/topic/add-new-tabs-to-display-custom-post-type/
I’m closing this topic.
Thank You!
- AuthorPosts
Viewing 1 reply thread
- The topic ‘Add two new tabs to display custom post type’ is closed to new replies.