Add two new tabs to display custom post type

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Ultimate Add two new tabs to display custom post type

Viewing 1 reply thread
  • Author
    Posts
    • #133314
      ceo3
      Participant

      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 );
      
    • #133416
      Sushobhan
      Keymaster

      Duplicate topic- https://wclovers.com/forums/topic/add-new-tabs-to-display-custom-post-type/
      I’m closing this topic.
      Thank You!

Viewing 1 reply thread
  • The topic ‘Add two new tabs to display custom post type’ is closed to new replies.