View difference between Paste ID: R7SKiccq and vDTkHVML
SHOW: | | - or go back to the newest paste.
1
add_action('wcfm_after_product_catalog_enquiry_button', function() {
2
    global $product;
3
    if( is_product() && $product && method_exists( $product, 'get_id' ) ) {
4
        $product_id = $product->get_id();
5
        $store_id = wcfm_get_vendor_id_by_post( $product_id );
6
        $store_user = wcfmmp_get_store( $store_id );
7
        $store_info = $store_user->get_shop_info();
8
        $phone = $store_user->get_phone();
9
        if( $phone && ( $store_info['store_hide_phone'] == 'no' ) && wcfm_vendor_has_capability( $store_user->get_id(), 'vendor_phone' ) ) {
10-
            echo "<a href='tel:{$phone}' class='wcfm_vendor_phone wcfm_chat_now_button' data-number='{$phone}'><span class='wcfmfa fa-phone'></span>&nbsp;&nbsp;<span class='add_enquiry_label'>Call</span></a>";
10+
            echo "<a href='tel:{$phone}' class='wcfm_vendor_phone wcfm_chat_now_button' data-number='{$phone}'><span class='wcfmfa fa-phone'></span>&nbsp;&nbsp;<span class='add_enquiry_label'>Call Dispensary</span></a>";
11
        }
12
    }
13
});
14
15
add_action( 'wcfmmp_store_after_follow_me', function($store_id) {
16
    echo do_shortcode("[wcfmmp_vendor_phone id='{$store_id}']");
17
});
18
19
add_shortcode('wcfmmp_vendor_phone', function($attr) {
20
    global $post, $WCFM;
21
    $vendor_id = '';
22
	if ( isset( $attr['id'] ) && !empty( $attr['id'] ) ) { 
23
        $vendor_id = absint($attr['id']); 
24
    }elseif (  wcfm_is_store_page() ) {
25
		$wcfm_store_url = get_option( 'wcfm_store_url', 'store' );
26
		$store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
27
		if ( !empty( $store_name ) ) {
28
			$store_user = get_user_by( 'slug', $store_name );
29
            $vendor_id = $store_user->ID;
30
		}
31
	}elseif( is_product() ) {
32
		$vendor_id = $post->post_author;
33
	}
34
    if( !$vendor_id && is_single() && $post && is_object( $post ) && wcfm_is_vendor( $post->post_author ) ) {
35
        $vendor_id = $post->post_author;
36
    }
37
    if(!$vendor_id) return;
38
    $store_user = wcfmmp_get_store( $vendor_id );
39
    $phone = $WCFM->wcfm_vendor_support->wcfm_vendor_has_capability( $vendor_id, 'vendor_phone' ) ? $store_user->get_phone() : '';
40
    if($phone) {
41
        ?>
42
        <style>
43-
        #wcfmmp-store .bd_icon_box #wcfm_phone_link {
43+
        #wcfmmp-store-phone-wrapper {
44-
            min-width: 50px;
44+
            text-align: center;
45-
            width: auto;
45+
46-
            padding: 0 15px;
46+
        #wcfmmp-store-phone-wrapper .elementor-button {
47-
            height: 30px;
47+
            font-size: 24px;
48-
            background: #fff;
48+
            background-color: #46BBFF;
49-
            color: #17a2b8;
49+
            border-radius: 10px 10px 10px 10px;
50-
            border-radius: 5px;
50+
51-
            display: inline-block;
51+
        #wcfmmp-store-phone-wrapper .elementor-button:hover, 
52-
            cursor: pointer;
52+
        #wcfmmp-store-phone-wrapper .elementor-button:focus {
53
            background-color: #FFA600;
54-
        #wcfmmp-store .bd_icon_box #wcfm_phone_link span {
54+
55-
            cursor: pointer;
55+
56-
            color: #17a2b8;
56+
        <div id="wcfmmp-store-phone-wrapper" class="elementor-button-wrapper">
57-
            margin-left: 0;
57+
            <a class="elementor-button elementor-size-sm" title="<?php _e( 'Phone', 'wc-frontend-manager-ultimate' ); ?>" href="<?php echo "tel:{$phone}"; ?>">
58-
            line-height: 30px;
58+
                <span class="elementor-button-content-wrapper">
59-
            display: inline-block;
59+
                    <span class="elementor-button-icon elementor-align-icon-left">
60-
            font-size: 13px;
60+
						<i aria-hidden="true" class="fas fa-phone-square"></i>			
61-
            position: relative;
61+
                    </span>
62-
            top: inherit;
62+
                    <span class="elementor-button-text">Call Dispensary</span>
63-
            left: inherit;
63+
                </span>
64-
            transform: translateX(0);
64+
            </a>
65-
            -moz-transform: translateX(0);
65+
		</div>
66-
            -ms-transform: translateX(0);
66+
67-
            -o-transform: translateX(0);
67+
68-
            -webkit-transform: translateX(0);
68+