Store “Custom Tab” PHP code crashes my site
-
Hi,
1. Is there a new easier way to create custom tabs on the vendor store page ?I was given this code long ago but my theme Rehub has had some major updates and it has stopped working.
2. As before according to your instructions, I created two folders wcfm/store in my child theme followed by the code : store/wcfmmp-view-store-art-works.php
3. I placed my shortcode
<? php echo do_shortcode( ‘[RH_ELEMENTOR id=”10332″]’ ); ?>
To: store/wcfmmp-view-store-art-works.php but it crashes my wesbite.
Any help would be much appreciated !
//Wcfm-Custom-Tabs//
<? add_action( ‘wcfmmp_rewrite_rules_loaded’, function( $wcfm_store_url ) { add_rewrite_rule( $wcfm_store_url.’/([^/]+)/art_works?$’, ‘index.php?’.$wcfm_store_url.’=$matches[1]&art_works=true’, ‘top’ ); add_rewrite_rule( $wcfm_store_url.’/([^/]+)/art_works/page/?([0-9]{1,})/?$’, ‘index.php?’.$wcfm_store_url.’=$matches[1]&paged=$matches[2]&art_works=true’, ‘top’ ); }, 50 ); add_filter( ‘query_vars’, function( $vars ) { $vars[] = ‘art_works’; return $vars; }, 50 ); add_filter( ‘wcfmmp_store_tabs’, function( $store_tabs, $store_id ) { $store_tabs[‘art_works’] = ‘Art Works’; return $store_tabs; }, 50, 2 ); add_filter( ‘wcfmp_store_tabs_url’, function( $store_tab_url, $tab ) { if( $tab == ‘art_works’ ) { $store_tab_url .= ‘art_works’; } return $store_tab_url; }, 50, 2 ); add_filter( ‘wcfmp_store_default_query_vars’, function( $query_var ) { global $WCFM, $WCFMmp; if ( get_query_var( ‘art_works’ ) ) { $query_var = ‘art_works’; } return $query_var; }, 50 ); add_filter( ‘wcfmp_store_default_template’, function( $template, $tab ) { if( $tab == ‘art_works’ ) { $template = ‘store/wcfmmp-view-store-art-works.php’; } return $template; }, 50, 2); ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Store “Custom Tab” PHP code crashes my site’ is closed to new replies.