Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'wcfmp_store_default_query_vars', function($tab, $vendor_id) {
- global $WCFMmp, $wp;
- if ( ! empty( $wp->query_vars['term_section'] ) || ! empty( $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', function ( $store_tabs, $id ) {
- $new_store_tabs = array();
- $keyOrder = [ 'about', 'policies', 'products', 'followers', 'reviews' ];
- foreach ( $keyOrder as $key ) {
- $new_store_tabs[$key] = $store_tabs[$key];
- }
- return array_filter( $new_store_tabs );
- }, 90, 2 );
- add_filter( 'wcfmp_store_tabs_url', function ( $store_tab_url, $tab ) {
- switch ( $tab ) {
- case 'products':
- $store_tab_url = $store_tab_url . 'products';
- break;
- }
- return $store_tab_url;
- }, 10, 2 );
- add_action( 'wcfmmp_rewrite_rules_loaded', function ( $wcfm_store_url ) {
- global $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' );
- }, 8 );
- add_action( 'init', function () {
- add_rewrite_endpoint( 'products', EP_ROOT | EP_PAGES );
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement