Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode('wcfm_store_featured_products', function($attr) {
- global $WCFM, $WCFMmp, $wp, $WCFM_Query, $post;
- $store_id = '';
- if ( isset( $attr['id'] ) && !empty( $attr['id'] ) ) { $store_id = absint($attr['id']); }
- if ( 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 ) );
- $store_id = 0;
- if ( !empty( $store_name ) ) {
- $store_user = get_user_by( 'slug', $store_name );
- }
- $store_id = $store_user->ID;
- }
- if( is_product() ) {
- $store_id = $post->post_author;
- }
- if( !$store_id && is_single() && $post && is_object( $post ) && wcfm_is_vendor( $post->post_author ) ) {
- $store_id = $post->post_author;
- }
- if ( isset( $attr['limit'] ) && !empty( $attr['limit'] ) ) {
- $limit = absint($attr['limit']);
- echo do_shortcode('[products store="'.$store_id.'" visibility="featured" limit="'.$limit.'"]');
- } else {
- echo do_shortcode('[products store="'.$store_id.'" visibility="featured" ]');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement