Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode('wcfm_store_reviews', function($attr) {
- global $WCFMmp, $post;
- if ( ! empty( $attr['id'] ) && absint( $attr['id'] ) ) {
- $vendor_id = absint( $attr['id'] );
- }elseif ( wcfm_is_store_page() ) {
- $wcfm_store_url = get_option( 'wcfm_store_url', 'store' );
- $store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
- if ( !empty( $store_name ) ) {
- $store_user = get_user_by( 'slug', $store_name );
- $vendor_id = $store_user->ID;
- }
- }elseif( is_product() ) {
- $vendor_id = $post->post_author;
- }
- if( !$vendor_id && is_single() && $post && is_object( $post ) && wcfm_is_vendor( $post->post_author ) ) {
- $vendor_id = $post->post_author;
- }
- if(!$vendor_id || !wcfm_is_vendor($vendor_id) ) return '';
- $store_user = wcfmmp_get_store( $vendor_id );
- $store_info = $store_user->get_shop_info();
- ob_start();
- $WCFMmp->template->get_template( 'store/wcfmmp-view-store-reviews.php', array( 'store_user' => $store_user, 'store_info' => $store_info ) );
- return ob_get_clean();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement