Theme and Plugin Support
-
AuthorPosts
-
-
January 8, 2021 at 10:50 PM #113280developer-8646Participant
Hello thank you very much for the support.
I would like to know how I can create a section of verified accounts, through shortcode.
I appreciate your prompt help.
-
January 9, 2021 at 6:42 PM #113330MVX Support NinjaKeymaster
Hi,
Please add this code in the function.php of the current active theme :add_action('init','function_add_shortcode'); function function_add_shortcode(){ add_shortcode('wcmp_verified_vendors', 'wcmp_verified_vendors_list'); } function wcmp_verified_vendors_list() { global $WCMp; $frontend_assets_path = $WCMp->plugin_url . 'assets/frontend/'; $frontend_assets_path = str_replace(array('http:', 'https:'), '', $frontend_assets_path); $suffix = defined('WCMP_SCRIPT_DEBUG') && WCMP_SCRIPT_DEBUG ? '' : '.min'; wp_register_style('wcmp_vendor_list', $frontend_assets_path . 'css/vendor-list' . $suffix . '.css', array(), $WCMp->version); wp_style_add_data('wcmp_vendor_list', 'rtl', 'replace'); wp_enqueue_style('wcmp_vendor_list'); $block_vendors = wp_list_pluck(wcmp_get_all_blocked_vendors(), 'id'); $vendors = get_wcmp_vendors( array('exclude' => $block_vendors), $return = 'id'); $verified_vendor_list = array(); foreach ($vendors as $vendor_id) { $vendor_verification_settings = get_user_meta($vendor_id, 'wcmp_vendor_verification_settings', true); $verified_vendor = get_user_meta( $vendor_id, '_verify_vendor', true); $verification_options = get_option('wcmp_vendor_verification_settings_name'); $option_enable = $verified = $social = 0; if($verification_options) { foreach($verification_options as $key => $option) { if($option == 'Enable') { if(isset($vendor_verification_settings[$key]['is_verified']) && $vendor_verification_settings[$key]['is_verified'] == 'verified') $verified++; $option_enable++; } } } if(isset($vendor_verification_settings['social_verification']) && count($vendor_verification_settings['social_verification']) > 1 ){ foreach ($vendor_verification_settings['social_verification'] as $provider => $settings) { $key = strtolower(sanitize_text_field($provider)); if(get_vendor_verification_settings($key.'_enable') == 'Enable') $social++; } } if( $option_enable == ($verified+$social) || $verified_vendor == 'Enable' ) { $verified_vendor_list[] = $vendor_id; } } ?> <div id="wcmp-store-conatiner"> <div class="wcmp-store-list-wrap"> <?php if ($verified_vendor_list && is_array($verified_vendor_list)) { foreach ($verified_vendor_list as $vendor_id) { $vendor = get_wcmp_vendor($vendor_id); $image = $vendor->get_image() ? $vendor->get_image('image', array(125, 125)) : $WCMp->plugin_url . 'assets/images/WP-stdavatar.png'; $banner = $vendor->get_image('banner') ? $vendor->get_image('banner') : ''; ?> <div class="wcmp-store-list"> <?php do_action('wcmp_vendor_lists_single_before_image', $vendor->term_id, $vendor->id); ?> <div class="wcmp-profile-wrap"> <div class="wcmp-cover-picture" style="background-image: url('<?php if($banner) echo $banner; ?>');"></div> <div class="store-badge-wrap"> <?php do_action('wcmp_vendor_lists_vendor_store_badges', $vendor); ?> </div> <div class="wcmp-store-info"> <div class="wcmp-store-picture"> <img class="vendor_img" src="<?php echo esc_url($image); ?>" id="vendor_image_display"> </div> <?php $rating_info = wcmp_get_vendor_review_info($vendor->term_id); $WCMp->template->get_template('review/rating_vendor_lists.php', array('rating_val_array' => $rating_info)); ?> </div> </div> <?php do_action('wcmp_vendor_lists_single_after_image', $vendor->term_id, $vendor->id); ?> <div class="wcmp-store-detail-wrap"> <?php do_action('wcmp_vendor_lists_vendor_before_store_details', $vendor); ?> <ul class="wcmp-store-detail-list"> <li> <i class="wcmp-font ico-store-icon"></i> <?php $button_text = apply_filters('wcmp_vendor_lists_single_button_text', $vendor->page_title); ?> <a href="<?php echo esc_url($vendor->get_permalink()); ?>" class="store-name"><?php echo esc_html($button_text); ?></a> <?php do_action('wcmp_vendor_lists_single_after_button', $vendor->term_id, $vendor->id); ?> <?php do_action('wcmp_vendor_lists_vendor_after_title', $vendor); ?> </li> <?php if($vendor->get_formatted_address()) : ?> <li> <i class="wcmp-font ico-location-icon2"></i> <p><?php echo esc_html($vendor->get_formatted_address()); ?></p> </li> <?php endif; ?> </ul> <?php do_action('wcmp_vendor_lists_vendor_after_store_details', $vendor); ?> </div> </div> <?php } } else { _e('No verified vendor found!', 'dc-woocommerce-multi-vendor'); } ?> </div> </div> <?php }
Copyand use below short code
[wcmp_verified_vendors]
CopyRegards,
-
January 11, 2021 at 11:16 PM #113441developer-8646Participant
Thanks a lot, apart from this could it handle more shortcodes?
-
January 12, 2021 at 6:02 PM #113498MVX Support NinjaKeymaster
Hi,
Please follow the link for WCMp existing Shortcodes – https://multivendorx.com/list-of-shortcodes/
If you want your own shortcodes then please do some custom code as per your requirement.Regards,
-
March 16, 2021 at 9:00 AM #117603MVX Support NinjaKeymaster
We have not received any update from you for a long. Hope this ticket is already been resolved.
We are now closing this ticket. Kindly create a new one if you need any further help.
-
-
AuthorPosts
The topic ‘Shortcode for verified accounts’ is closed to new replies.