Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Vendors › Is there a way to display the "About" tab as default instead of "Products" tab
- This topic has 2 replies, 2 voices, and was last updated 4 years, 9 months ago by Matt Flood.
Viewing 2 reply threads
- AuthorPosts
- March 19, 2020 at 7:35 am #112221Matt FloodParticipant
Is there a way to display the “About” tab as default instead of “Products” tab on the store detail page?
- March 19, 2020 at 11:39 am #112237Sarmistha ChakrabortyMember
Hi,
add_filter('wcfmp_store_default_query_vars',function($tab,$vendor_id){ global $WCFM, $WCFMmp,$wp; if ($wp->query_vars['term_section'] || $wp->query_vars['s'] || get_query_var( $WCFMmp->wcfmmp_rewrite->store_endpoint('products') ) ) { return 'products'; } else { return 'about'; } },20,2); add_filter( 'wcfmmp_store_tabs', 'new_wcfmmp_store_tabs',90,2); function new_wcfmmp_store_tabs($store_tabs, $id) { $new_store_tabs = array(); $keyOrder = ['about','products','policies','followers','reviews']; foreach($keyOrder as $key) { $new_store_tabs[$key] = $store_tabs[$key]; } return array_filter($new_store_tabs); } add_filter( 'wcfmp_store_tabs_url', 'new_wcfmp_store_tabs_url',10,2); function new_wcfmp_store_tabs_url($store_tab_url, $tab) { switch( $tab ) { case 'products': $store_tab_url = $store_tab_url.'products'; break; } return $store_tab_url; } add_action( 'wcfmmp_rewrite_rules_loaded', 'new_register_rule', 8 ); function new_register_rule($wcfm_store_url) { global $WCFM, $WCFMmp; add_rewrite_rule( $wcfm_store_url.'/([^/]+)/'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'?$', 'index.php?post_type=product&'.$wcfm_store_url.'=$matches[1]&'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'=true', 'top' ); add_rewrite_rule( $wcfm_store_url.'/([^/]+)/'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'/page/?([0-9]{1,})/?$', 'index.php?post_type=product&'.$wcfm_store_url.'=$matches[1]&paged=$matches[2]&'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'=true', 'top' ); } function wcfm_vendor_profile_custom_endpoint() { global $WCFM, $WCFMmp,$WCFMu; add_rewrite_endpoint( 'products', EP_ROOT | EP_PAGES ); } add_action( 'init', 'wcfm_vendor_profile_custom_endpoint' );
Try this code to your child theme’s functions.php.
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/Thanks.
- March 19, 2020 at 9:33 pm #112295Matt FloodParticipant
That worked like a charm!! Thank you!
- AuthorPosts
Viewing 2 reply threads
- You must be logged in to reply to this topic.