Click to Chat for WhatsApp Chat - Version 3.3

Version Description

  • New: Custom Element/Design, Create an element/design and add
    • Class name: ctc_chat (or)
    • ID name: ctc_chat (or)
    • Href/link attribute: #ctc_chat
Download this release

Release Info

Developer bhvreddy
Plugin Icon 128x128 Click to Chat for WhatsApp Chat
Version 3.3
Comparing to
See all releases

Code changes from version 3.2.9 to 3.3

click-to-chat.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Click to Chat
4
  Plugin URI: https://wordpress.org/plugins/click-to-chat-for-whatsapp/
5
  Description: Lets make your Web page visitors contact you through WhatsApp with a single click/tap
6
- Version: 3.2.9
7
  Author: HoliThemes
8
  Author URI: https://holithemes.com/plugins/click-to-chat/
9
  License: GPL2
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
17
 
18
  // ctc - Version - update version at readme 'Stable tag'
19
  if ( ! defined( 'HT_CTC_VERSION' ) ) {
20
- define( 'HT_CTC_VERSION', '3.2.9' );
21
  }
22
 
23
  // define HT_CTC_PLUGIN_FILE
3
  Plugin Name: Click to Chat
4
  Plugin URI: https://wordpress.org/plugins/click-to-chat-for-whatsapp/
5
  Description: Lets make your Web page visitors contact you through WhatsApp with a single click/tap
6
+ Version: 3.3
7
  Author: HoliThemes
8
  Author URI: https://holithemes.com/plugins/click-to-chat/
9
  License: GPL2
17
 
18
  // ctc - Version - update version at readme 'Stable tag'
19
  if ( ! defined( 'HT_CTC_VERSION' ) ) {
20
+ define( 'HT_CTC_VERSION', '3.3' );
21
  }
22
 
23
  // define HT_CTC_PLUGIN_FILE
new/admin/class-ht-ctc-admin-main-page.php CHANGED
@@ -297,6 +297,7 @@ class HT_CTC_Admin_Main_Page {
297
  <p class="description"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>">Customize Styles</a></p>
298
  <p class="description"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-other-settings' ); ?>">Other Settings</a></p>
299
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/shortcodes-chat">Shortcodes for Chat: </a>[ht-ctc-chat]</p>
 
300
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/faq">Frequently Asked Questions (FAQ)</a></p>
301
 
302
  <?php
297
  <p class="description"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-customize-styles' ); ?>">Customize Styles</a></p>
298
  <p class="description"><a target="_blank" href="<?php echo admin_url( 'admin.php?page=click-to-chat-other-settings' ); ?>">Other Settings</a></p>
299
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/shortcodes-chat">Shortcodes for Chat: </a>[ht-ctc-chat]</p>
300
+ <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/custom-element">Custom Element: </a>Class name: ctc_chat | Href/Link: #ctc_chat</p>
301
  <p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/faq">Frequently Asked Questions (FAQ)</a></p>
302
 
303
  <?php
new/admin/class-ht-ctc-admin-other-settings.php CHANGED
@@ -287,8 +287,7 @@ class HT_CTC_Admin_Other_Settings {
287
 
288
  ?>
289
  </select>
290
- <label><?php _e( 'How to display', 'click-to-chat-for-whatsapp' ); ?></label>
291
- <p class="description" style="font-size: 0.9em">(<?php _e( 'Looks good for some styles or if no-animation', 'click-to-chat-for-whatsapp' ); ?>)</p>
292
  </div>
293
  </div>
294
 
@@ -368,7 +367,7 @@ class HT_CTC_Admin_Other_Settings {
368
  <input name="ht_ctc_othersettings[enable_group]" type="checkbox" value="1" <?php checked( $options['enable_group'], 1 ); ?> id="enable_group" />
369
  <span><?php _e( 'Enable Group Features', 'click-to-chat-for-whatsapp' ); ?></span>
370
  </label>
371
- <p class="description"> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-group-feature' ); ?>"><?php _e( 'Group Settings page', 'click-to-chat-for-whatsapp' ); ?></a> </p>
372
  </p>
373
  <?php
374
  } else {
@@ -379,7 +378,7 @@ class HT_CTC_Admin_Other_Settings {
379
  <span><?php _e( 'Enable Group Features', 'click-to-chat-for-whatsapp' ); ?></span>
380
  </label>
381
  </p>
382
- <p class="description"> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/enable-group-feature/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
383
  <?php
384
  }
385
  ?>
@@ -395,7 +394,7 @@ class HT_CTC_Admin_Other_Settings {
395
  <input name="ht_ctc_othersettings[enable_share]" type="checkbox" value="1" <?php checked( $options['enable_share'], 1 ); ?> id="enable_share" />
396
  <span><?php _e( 'Enable Share Features', 'click-to-chat-for-whatsapp' ); ?></span>
397
  </label>
398
- <p class="description"> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-share-feature' ); ?>"><?php _e( 'Share Settings page', 'click-to-chat-for-whatsapp' ); ?></a> </p>
399
  </p>
400
  <?php
401
  } else {
@@ -406,7 +405,7 @@ class HT_CTC_Admin_Other_Settings {
406
  <span><?php _e( 'Enable Share Features', 'click-to-chat-for-whatsapp' ); ?></span>
407
  </label>
408
  </p>
409
- <p class="description"> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/enable-share-feature/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
410
  <?php
411
  }
412
  ?>
287
 
288
  ?>
289
  </select>
290
+ <label><?php _e( 'How the Icon/Button displays', 'click-to-chat-for-whatsapp' ); ?></label>
 
291
  </div>
292
  </div>
293
 
367
  <input name="ht_ctc_othersettings[enable_group]" type="checkbox" value="1" <?php checked( $options['enable_group'], 1 ); ?> id="enable_group" />
368
  <span><?php _e( 'Enable Group Features', 'click-to-chat-for-whatsapp' ); ?></span>
369
  </label>
370
+ <p class="description"> <?php _e( 'Adds WhatsApp Icon for Group', 'click-to-chat-for-whatsapp' ); ?> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-group-feature' ); ?>"><?php _e( 'Group Settings page', 'click-to-chat-for-whatsapp' ); ?></a> </p>
371
  </p>
372
  <?php
373
  } else {
378
  <span><?php _e( 'Enable Group Features', 'click-to-chat-for-whatsapp' ); ?></span>
379
  </label>
380
  </p>
381
+ <p class="description"> <?php _e( 'Adds WhatsApp Icon for Group', 'click-to-chat-for-whatsapp' ); ?> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/enable-group-feature/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
382
  <?php
383
  }
384
  ?>
394
  <input name="ht_ctc_othersettings[enable_share]" type="checkbox" value="1" <?php checked( $options['enable_share'], 1 ); ?> id="enable_share" />
395
  <span><?php _e( 'Enable Share Features', 'click-to-chat-for-whatsapp' ); ?></span>
396
  </label>
397
+ <p class="description"> <?php _e( 'Adds WhatsApp Icon for Share', 'click-to-chat-for-whatsapp' ); ?> - <a href="<?php echo admin_url( 'admin.php?page=click-to-chat-share-feature' ); ?>"><?php _e( 'Share Settings page', 'click-to-chat-for-whatsapp' ); ?></a> </p>
398
  </p>
399
  <?php
400
  } else {
405
  <span><?php _e( 'Enable Share Features', 'click-to-chat-for-whatsapp' ); ?></span>
406
  </label>
407
  </p>
408
+ <p class="description"> <?php _e( 'Adds WhatsApp Icon for Share', 'click-to-chat-for-whatsapp' ); ?> - <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/enable-share-feature/"><?php _e( 'more info', 'click-to-chat-for-whatsapp' ); ?></a> </p>
409
  <?php
410
  }
411
  ?>
new/admin/class-ht-ctc-admin-scripts.php CHANGED
@@ -18,7 +18,7 @@ class HT_CTC_Admin_Scripts {
18
  function register_scripts_admin($hook) {
19
 
20
  // true/false
21
- $load_js_bottom = apply_filters( 'ht_ctc_fh_load_js_bottom', false );
22
 
23
  // $admin_js = 'admin.js';
24
  $admin_js = '329.admin.js';
18
  function register_scripts_admin($hook) {
19
 
20
  // true/false
21
+ $load_js_bottom = apply_filters( 'ht_ctc_fh_load_admin_js_bottom', true );
22
 
23
  // $admin_js = 'admin.js';
24
  $admin_js = '329.admin.js';
new/inc/assets/js/app.js CHANGED
@@ -1 +1 @@
1
- !function(h){h(function(){var t,a=window.location.href,o=void 0!==document.title?document.title:"",c=void 0!==screen.width&&1024<screen.width?"no":"yes",i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,e();else{try{document.querySelector(".ht-ctc-chat")&&(t=h(".ht-ctc-chat").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}e()}function e(){var t;h(document).trigger("ht_ctc_ce_settings",[i]),(t=document.querySelector(".ht-ctc-chat"))&&(h(t).trigger("ht_ctc_ce_chat"),function(t){"yes"==i.schedule?h(document).trigger("ht_ctc_display",[i,n,t]):n(t)}(t),t.addEventListener("click",function(){!function(t){var e=i.number,n=i.pre_filled;if(n=n.replace(/\[url]/gi,a),n=encodeURIComponent(n),""==e)return t.innerHTML=t.getAttribute("data-no_number");"webapi"==i.webandapi&&"yes"!==c?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+n,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+n,"_blank","noopener")}(t),s(t)})),h(document).on("click",".ht-ctc-sc-chat",function(){var t,e=this.getAttribute("data-number"),n=(n=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,a);n=encodeURIComponent(n),"webapi"==this.getAttribute("data-webandapi")?(t="yes"==c?"https://api.whatsapp.com/send":"https://web.whatsapp.com/send",window.open(t+"?phone="+e+"&text="+n,"_blank","noopener")):(t="https://wa.me/",window.open(t+e+"?text="+n,"_blank","noopener")),s(this)})}function n(t){var e;"yes"==c?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,r(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,r(t))}function r(e){try{h(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t;t=e,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},120),h(".ht-ctc-chat").hover(function(){h(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){h(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function s(t){h(document).trigger("ht_ctc_analytics");var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var n="Click to Chat for WhatsApp",c="chat: "+e,t=o+", "+a;"yes"==i.ga&&("undefined"!=typeof gtag?gtag("event",c,{event_category:n,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",n,c,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",n,c,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",event_category:n,event_label:t,event_action:c}),"yes"==i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),"yes"==i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:o,URL:a})}})}(jQuery);
1
+ !function(d){d(function(){var t,a=window.location.href,o=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,e();else{try{document.querySelector(".ht-ctc-chat")&&(t=d(".ht-ctc-chat").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}e()}function e(){var t;d(document).trigger("ht_ctc_ce_settings",[i]),(t=document.querySelector(".ht-ctc-chat"))&&(d(t).trigger("ht_ctc_ce_chat"),function(t){"yes"==i.schedule?d(document).trigger("ht_ctc_display",[i,c,t]):c(t)}(t),t.addEventListener("click",function(){h(t)})),d(document).on("click",".ht-ctc-sc-chat",function(){var t,e=this.getAttribute("data-number"),c=(c=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,a);c=encodeURIComponent(c),"webapi"==this.getAttribute("data-webandapi")?(t="yes"==n?"https://api.whatsapp.com/send":"https://web.whatsapp.com/send",window.open(t+"?phone="+e+"&text="+c,"_blank","noopener")):(t="https://wa.me/",window.open(t+e+"?text="+c,"_blank","noopener")),s(this)}),d(document).on("click",".ctc_chat, #ctc_chat",function(){h(this)}),d(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),h(this)})}function c(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,r(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,r(t))}function r(e){try{d(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t;t=e,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},120),d(".ht-ctc-chat").hover(function(){d(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){d(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function s(t){d(document).trigger("ht_ctc_analytics");var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=o+", "+a;"yes"==i.ga&&("undefined"!=typeof gtag?gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",event_category:c,event_label:t,event_action:n}),"yes"==i.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),"yes"==i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:o,URL:a})}function h(t){var e=i.number,c=(c=i.pre_filled).replace(/\[url]/gi,a);c=encodeURIComponent(c),""!=e?("webapi"==i.webandapi&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),s(t)):d(".ht-ctc-chat").html(d(".ht_ctc_no_number").attr("data-no_number"))}})}(jQuery);
new/inc/assets/js/dev/app.dev.js CHANGED
@@ -38,6 +38,9 @@ $(function () {
38
  // shortcode
39
  shortcode();
40
 
 
 
 
41
  }
42
 
43
 
@@ -47,16 +50,17 @@ $(function () {
47
  var ht_ctc_chat = document.querySelector('.ht-ctc-chat');
48
  if (ht_ctc_chat) {
49
 
50
- $(ht_ctc_chat).trigger('ht_ctc_ce_chat');
 
51
  // display
52
  display_settings(ht_ctc_chat);
 
53
  // click
54
  ht_ctc_chat.addEventListener('click', function () {
55
  // link
56
  ht_ctc_link(ht_ctc_chat);
57
- // analytics
58
- ht_ctc_chat_analytics(ht_ctc_chat);
59
  });
 
60
  }
61
  }
62
 
@@ -206,13 +210,15 @@ $(function () {
206
  // link - chat
207
  function ht_ctc_link(values) {
208
 
 
209
  var number = ctc.number;
210
  var pre_filled = ctc.pre_filled;
211
  pre_filled = pre_filled.replace(/\[url]/gi, url);
212
  pre_filled = encodeURIComponent(pre_filled);
213
 
214
  if ( '' == number ) {
215
- values.innerHTML = values.getAttribute('data-no_number');
 
216
  return;
217
  }
218
 
@@ -225,6 +231,9 @@ $(function () {
225
  window.open('https://wa.me/' + number + '?text=' + pre_filled, '_blank', 'noopener');
226
  }
227
 
 
 
 
228
  }
229
 
230
  // shortcode
@@ -257,6 +266,21 @@ $(function () {
257
  });
258
  }
259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  });
261
 
262
  })(jQuery);
38
  // shortcode
39
  shortcode();
40
 
41
+ // custom element
42
+ link();
43
+
44
  }
45
 
46
 
50
  var ht_ctc_chat = document.querySelector('.ht-ctc-chat');
51
  if (ht_ctc_chat) {
52
 
53
+ $(document).trigger('ht_ctc_ce_chat');
54
+
55
  // display
56
  display_settings(ht_ctc_chat);
57
+
58
  // click
59
  ht_ctc_chat.addEventListener('click', function () {
60
  // link
61
  ht_ctc_link(ht_ctc_chat);
 
 
62
  });
63
+
64
  }
65
  }
66
 
210
  // link - chat
211
  function ht_ctc_link(values) {
212
 
213
+ console.log(values);
214
  var number = ctc.number;
215
  var pre_filled = ctc.pre_filled;
216
  pre_filled = pre_filled.replace(/\[url]/gi, url);
217
  pre_filled = encodeURIComponent(pre_filled);
218
 
219
  if ( '' == number ) {
220
+ // values.innerHTML = values.getAttribute('data-no_number');
221
+ $(".ht-ctc-chat").html($(".ht_ctc_no_number").attr('data-no_number'));
222
  return;
223
  }
224
 
231
  window.open('https://wa.me/' + number + '?text=' + pre_filled, '_blank', 'noopener');
232
  }
233
 
234
+ // analytics
235
+ ht_ctc_chat_analytics(values);
236
+
237
  }
238
 
239
  // shortcode
266
  });
267
  }
268
 
269
+ // custom element
270
+ function link() {
271
+
272
+ $(document).on('click', '.ctc_chat, #ctc_chat', function () {
273
+ console.log('class/Id: ctc_chat');
274
+ ht_ctc_link(this);
275
+ });
276
+
277
+ $(document).on('click', '[href="#ctc_chat"]', function (e) {
278
+ console.log('#ctc_chat');
279
+ e.preventDefault();
280
+ ht_ctc_link(this);
281
+ });
282
+ }
283
+
284
  });
285
 
286
  })(jQuery);
new/inc/chat/class-ht-ctc-chat.php CHANGED
@@ -40,6 +40,18 @@ class HT_CTC_Chat {
40
  // page level
41
  $ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
42
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  // is mobile
45
  $is_mobile = ht_ctc()->device_type->is_mobile();
@@ -84,20 +96,20 @@ class HT_CTC_Chat {
84
  $ht_ctc_chat['display_desktop'] = (isset($options['hideon_desktop'])) ? 'hide' : 'show';
85
 
86
  // number not added and is administrator
87
- $no_number = "added";
88
- $admin_url = admin_url( 'admin.php?page=click-to-chat' );
89
- $admin_link = "<a href='$admin_url'>WhatsApp number</a>";
90
-
91
  if ( '' == $ht_ctc_chat['number'] ) {
92
  $no_number = "<p style='background-color:#ffffff; margin:0; border:1px solid #fbfbfb; padding:7px; border-radius:4px; box-shadow:5px 10px 8px #888888;'>No WhatsApp Number Found!</p>";
93
  if ( current_user_can('administrator') ) {
 
 
94
  $no_number = "<p style='background-color:#ffffff; margin:0; border:1px solid #fbfbfb; padding:11px; border-radius:4px; box-shadow:5px 10px 8px #888888;'>No WhatsApp Number Found!<br><small style='color:red;'>Admin Notice:<br></small><small>Add $admin_link at pluign Settings<br>If already added, <strong>clear the Cache</strong> and try.<br>If still an issue, please contact plugin developers</small></p>";
95
  }
96
  }
97
 
98
  // class names
99
- $ht_ctc_chat['class_names'] = "ht-ctc ht-ctc-chat ctc-analytics ";
100
- $ht_ctc_chat['id'] = "ht-ctc-chat ";
101
  // schedule
102
  $ht_ctc_chat['schedule'] = 'no';
103
 
@@ -208,6 +220,17 @@ class HT_CTC_Chat {
208
  'v' => $ht_ctc_os['v'],
209
  );
210
 
 
 
 
 
 
 
 
 
 
 
 
211
  $ctc = apply_filters( 'ht_ctc_fh_ctc', $ctc );
212
 
213
  // data-attribute - data-settings
@@ -216,22 +239,11 @@ class HT_CTC_Chat {
216
  wp_localize_script( 'ht_ctc_app_js', 'ht_ctc_chat_var', $ctc );
217
 
218
 
219
- /**
220
- * show/hide
221
- *
222
- * $page_display - page level settings - show/hide/ null
223
- * $display - global display settings - changes at - show-hide.php
224
- */
225
- $display = '';
226
- $page_display = (isset($ht_ctc_pagelevel['show_hide'])) ? esc_attr($ht_ctc_pagelevel['show_hide']) : '';
227
 
228
- if ( 'show' !== $page_display ) {
229
- include HT_CTC_PLUGIN_DIR .'new/inc/commons/show-hide.php';
230
- // 'no' == $display - hided from global settings
231
- // 'hide' == $page_display - hided at page level settings
232
- if ( 'no' == $display || 'hide' == $page_display ) {
233
- return;
234
- }
235
  }
236
 
237
 
@@ -254,7 +266,6 @@ class HT_CTC_Chat {
254
  data-position="<?php echo $ht_ctc_chat['position'] ?>"
255
  data-position_mobile="<?php echo $ht_ctc_chat['position_mobile'] ?>"
256
  data-show_effect="<?php echo $ht_ctc_os['show_effect'] ?>"
257
- data-no_number="<?php echo $no_number ?>"
258
  data-settings="<?php echo $ht_ctc_settings ?>"
259
  <?php echo $ht_ctc_os['data-attributes'] ?>
260
  <?php echo $on ?>
@@ -272,6 +283,14 @@ class HT_CTC_Chat {
272
  </div>
273
  <?php
274
  do_action('ht_ctc_ah_after_fixed_position');
 
 
 
 
 
 
 
 
275
  }
276
 
277
 
40
  // page level
41
  $ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
42
 
43
+ /**
44
+ * show/hide
45
+ * $page_display - page level settings - show/hide/ null
46
+ * $display - global display settings - changes at - show-hide.php
47
+ */
48
+ $display = '';
49
+ $page_display = (isset($ht_ctc_pagelevel['show_hide'])) ? esc_attr($ht_ctc_pagelevel['show_hide']) : '';
50
+
51
+ if ( 'show' !== $page_display ) {
52
+ include HT_CTC_PLUGIN_DIR .'new/inc/commons/show-hide.php';
53
+ }
54
+
55
 
56
  // is mobile
57
  $is_mobile = ht_ctc()->device_type->is_mobile();
96
  $ht_ctc_chat['display_desktop'] = (isset($options['hideon_desktop'])) ? 'hide' : 'show';
97
 
98
  // number not added and is administrator
99
+ $no_number = '';
100
+
 
 
101
  if ( '' == $ht_ctc_chat['number'] ) {
102
  $no_number = "<p style='background-color:#ffffff; margin:0; border:1px solid #fbfbfb; padding:7px; border-radius:4px; box-shadow:5px 10px 8px #888888;'>No WhatsApp Number Found!</p>";
103
  if ( current_user_can('administrator') ) {
104
+ $admin_url = admin_url( 'admin.php?page=click-to-chat' );
105
+ $admin_link = "<a href='$admin_url'>WhatsApp number</a>";
106
  $no_number = "<p style='background-color:#ffffff; margin:0; border:1px solid #fbfbfb; padding:11px; border-radius:4px; box-shadow:5px 10px 8px #888888;'>No WhatsApp Number Found!<br><small style='color:red;'>Admin Notice:<br></small><small>Add $admin_link at pluign Settings<br>If already added, <strong>clear the Cache</strong> and try.<br>If still an issue, please contact plugin developers</small></p>";
107
  }
108
  }
109
 
110
  // class names
111
+ $ht_ctc_chat['class_names'] = "ht-ctc ht-ctc-chat ctc-analytics";
112
+ $ht_ctc_chat['id'] = "ht-ctc-chat";
113
  // schedule
114
  $ht_ctc_chat['schedule'] = 'no';
115
 
220
  'v' => $ht_ctc_os['v'],
221
  );
222
 
223
+
224
+ // adds if hided
225
+ if ( 'no' == $display ) {
226
+ $ctc['display'] = 'no';
227
+ }
228
+
229
+ if ( 'hide' == $page_display ) {
230
+ $ctc['page_display'] = 'hide';
231
+ }
232
+
233
+
234
  $ctc = apply_filters( 'ht_ctc_fh_ctc', $ctc );
235
 
236
  // data-attribute - data-settings
239
  wp_localize_script( 'ht_ctc_app_js', 'ht_ctc_chat_var', $ctc );
240
 
241
 
 
 
 
 
 
 
 
 
242
 
243
+ // 'no' == $display - hided from global settings (display can be no, only after checking page display is not show)
244
+ // 'hide' == $page_display - hided at page level settings
245
+ if ( 'no' == $display || 'hide' == $page_display ) {
246
+ return;
 
 
 
247
  }
248
 
249
 
266
  data-position="<?php echo $ht_ctc_chat['position'] ?>"
267
  data-position_mobile="<?php echo $ht_ctc_chat['position_mobile'] ?>"
268
  data-show_effect="<?php echo $ht_ctc_os['show_effect'] ?>"
 
269
  data-settings="<?php echo $ht_ctc_settings ?>"
270
  <?php echo $ht_ctc_os['data-attributes'] ?>
271
  <?php echo $on ?>
283
  </div>
284
  <?php
285
  do_action('ht_ctc_ah_after_fixed_position');
286
+
287
+ // if no_number
288
+ if ('' == $ht_ctc_chat['number']) {
289
+ ?>
290
+ <span class="ht_ctc_no_number" data-no_number="<?php echo $no_number ?>"></span>
291
+ <?php
292
+ }
293
+
294
  }
295
 
296
 
new/inc/share/class-ht-ctc-share.php CHANGED
@@ -72,7 +72,7 @@ class HT_CTC_Share {
72
  $ht_ctc_share['call_to_action'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_share['call_to_action'], 'Click to Chat for WhatsApp', 'call_to_action__share' );
73
 
74
  // class names
75
- $ht_ctc_share['class_names'] = " ht-ctc ht-ctc-share ";
76
 
77
  $page_url = get_permalink();
78
  $post_title = esc_html( get_the_title() );
@@ -121,7 +121,7 @@ class HT_CTC_Share {
121
  $style_mobile = $ht_ctc_share['style_mobile'];
122
  $call_to_action = $ht_ctc_share['call_to_action'];
123
 
124
- $ht_ctc_share['class_names'] .= " style-$style ";
125
 
126
  if ( '' == $call_to_action ) {
127
  if ( '1' == $style || '4' == $style || '6' == $style || '8' == $style ) {
72
  $ht_ctc_share['call_to_action'] = apply_filters( 'wpml_translate_single_string', $ht_ctc_share['call_to_action'], 'Click to Chat for WhatsApp', 'call_to_action__share' );
73
 
74
  // class names
75
+ $ht_ctc_share['class_names'] = "ht-ctc ht-ctc-share";
76
 
77
  $page_url = get_permalink();
78
  $post_title = esc_html( get_the_title() );
121
  $style_mobile = $ht_ctc_share['style_mobile'];
122
  $call_to_action = $ht_ctc_share['call_to_action'];
123
 
124
+ $ht_ctc_share['class_names'] .= " style-$style";
125
 
126
  if ( '' == $call_to_action ) {
127
  if ( '1' == $style || '4' == $style || '6' == $style || '8' == $style ) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Requires at least: 4.6
3
  Tested up to: 5.7
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
- Stable tag: 3.2.9
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, social chat, whatsapp wordpress, whatsapp floating button, whatsapp icon, holithemes
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -22,41 +22,60 @@ Let's make your Web page visitors Contact you through "WhatsApp", "WhatsApp Busi
22
 
23
  Add your 'WhatsApp' or 'WhatsApp Business' Number. And let your website visitors contact you with a single click.
24
 
25
- **📱 Mobile:** Chat from WhatsApp Mobile App.
 
 
26
 
27
- **💻 Desktop:** Chat from WhatsApp Desktop App or from Web WhatsApp page(web.whatsapp.com).
28
 
29
  = 💎 Styles =
30
 
31
  Select a Style that matches your Website design.
32
 
33
- > 8 predefined styles + Add your own Image/GIF.
 
 
 
 
 
 
 
 
 
 
34
 
35
- Can Select different Styles for Mobile, Desktop.
36
 
37
  = 🌼 Add Own Image =
38
 
39
- Instead of selecting a pre-defined style, add any image/Animated image/GIF.
40
 
41
- = ✳️ Position to Place =
42
 
43
- > Add styles at any position of the screen
44
- (not limited to fixed positions).
 
 
 
45
 
46
- > can set different positions for Mobile and Desktop.
47
 
 
 
 
 
 
 
48
  = ⏩ Pre-filled Message =
49
 
50
- Text that appears at the WhatsApp chat window when the user clicks on the Image/button.
51
 
52
  Users can start the conversation easily.
53
 
54
  Variables to change values dynamically
55
 
56
- {site} -> Website Title
57
- {title} -> Page Title
58
- {url} -> Web page URL
59
- [url] -> Web page full URL including parameters
60
 
61
  With these variables, we can understand from which page the user started WhatsApp chat.
62
 
@@ -66,19 +85,23 @@ With these variables, we can understand from which page the user started WhatsAp
66
 
67
  Separate 'pre-filled message', 'call to action' settings for WooCommerce Single product pages.
68
 
69
- Additional, variables for WooCommerce to change values dynamically
70
 
71
- {product} -> Product Name
72
- {price} -> Product Price (current price)
73
- {regular_price} -> Regular product price (with out any sale)
74
- {sku} ->Stock keeping unit
75
 
76
  = 📒 Change Settings at page level =
77
 
78
- > Change 'WhatsApp Number', 'Call to Action' at the page level
79
-
80
  (while editing the post, at the right side bar 'Click to Chat' metabox)
81
 
 
 
 
 
 
82
  [Page level settings](https://holithemes.com/plugins/click-to-chat/change-values-at-page-level/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
83
 
84
  = 📈 Analytics =
@@ -91,45 +114,35 @@ Creates an Event when the user clicks on the WhatsApp Icon/button.
91
 
92
  [Google Ads Conversations](https://holithemes.com/plugins/click-to-chat/google-ads-conversion/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
93
 
94
- = 🌈 Eight Styles + own Image =
95
-
96
- 1. **Style-1:** Button, appears as the theme button.
97
- 1. **Style-2:** Image
98
- 1. **Style-3:** Image
99
- 1. **Style-3 Extend:** Image [New]
100
- 1. **Style-4:** Chip style - a combination of image and a text message
101
- 1. **Style-5:** Image, on hover shows sidebar content-box
102
- 1. **Style-6:** Plain text with a link
103
- 1. **Style-7:** Icon with customizable padding
104
- 1. **Style-7 Extend:** Icon with call to action on hover [New]
105
- 1. **Style-8:** Button with text, icon
106
- 1. **Style-99:** Own Image / GIF / Animated image
107
-
108
- [list of Styles](https://holithemes.com/plugins/click-to-chat/list-of-styles/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
109
-
110
- ✏️ [Styles are customizable](https://holithemes.com/plugins/click-to-chat/customize-styles/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
111
 
112
  = 🔆 Localization =
113
 
114
- Compatible with [WPML](https://wpml.org/), Polylang.
115
 
116
- Easy to setup different values for each language
117
 
118
  * WhatsApp Number
119
  * Call to Action
120
- * Pre-filled message
 
 
121
 
122
  Setup for [WPML](https://holithemes.com/plugins/click-to-chat/translate-click-to-chat-settings-using-wpml-plugin/?utm_source=wp&utm_medium=readme&utm_campaign=ht), [Polylang](https://holithemes.com/plugins/click-to-chat/translate-click-to-chat-settings-using-polylang-plugin/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
123
 
124
  = 🚀 Performance =
125
 
126
- Rich in features but the frontend of the site content is very light weight.
127
 
128
- We highly concentrate on performance.
129
 
130
  = 👓 Display Settings =
131
 
132
- Show or Hide styles based on Post type, Post ID, Category, Device Type(Mobile, Desktop).
 
 
 
 
 
133
 
134
  = ⛳ Shortcodes =
135
 
@@ -179,10 +192,9 @@ i.e. if position is set to right: 10px then plugin will display at left: 10px
179
 
180
  1. 8 Styles, 1 Add own image / GIF Style
181
  1. Chat Settings - Enter WhatsApp Number, prefilled message, call to action, desktop: web view / desktop app view
182
- 1. Desktop settings - style, position to place
183
- 1. Mobile settings - style, position to place
184
  1. Change Values at page level: 'WhatsApp Number', 'Call to action', 'Group ID'
185
- 1. Add style at any position of the screen
186
  1. Shortcodes - add style with inline the content
187
  1. Style - 5 - Image with content box
188
  1. Style - 8 - Materialize button
@@ -194,6 +206,8 @@ i.e. if position is set to right: 10px then plugin will display at left: 10px
194
  1. Hide on Selected pages
195
  1. Show on Selected pages
196
  1. prefilled, call to action for WooCommerce single product pages
 
 
197
 
198
 
199
  == Installation ==
@@ -372,13 +386,13 @@ For any queries, please contact us.
372
 
373
  For any issues with the plugin / suggestions:
374
 
375
- * 📧 [ctc@holithemes.com](mailto: ctc@holithemes.com)
376
 
377
  * [WhatsApp](http://api.whatsapp.com/send?phone=919494429789&text=Hi%20HoliThemes,%20I%20have%20a%20question:)
378
 
379
- * WordPress Support forum for Click to Chat - please create a [new topic](https://wordpress.org/support/plugin/click-to-chat-for-whatsapp/)
380
 
381
- * [GitHub Discussions](https://github.com/holithemes/ctc/discussions)
382
 
383
  = ⭐️ Give Support =
384
 
@@ -405,6 +419,12 @@ After Activate the plugin, add WhatsApp Number at plugin settings.
405
 
406
  == Changelog ==
407
 
 
 
 
 
 
 
408
  = 3.2.9 =
409
  * Performance Improvement
410
  * Fix: WooCommerce Prefilled Message Muliple lines
3
  Tested up to: 5.7
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
+ Stable tag: 3.3
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, social chat, whatsapp wordpress, whatsapp floating button, whatsapp icon, holithemes
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
22
 
23
  Add your 'WhatsApp' or 'WhatsApp Business' Number. And let your website visitors contact you with a single click.
24
 
25
+ **📱 Mobile:** Navigates to WhatsApp Mobile App.
26
+
27
+ **💻 Desktop:** Navigates to WhatsApp Desktop App / Web WhatsApp page(web.whatsapp.com)
28
 
 
29
 
30
  = 💎 Styles =
31
 
32
  Select a Style that matches your Website design.
33
 
34
+ * 8 pre-defined style/designs
35
+ * Add your own Image/GIF
36
+ * Custom Element
37
+ * Shortcodes
38
+ * Select different Styles for Mobile, Desktop
39
+ * All pre-defined styles are customizable
40
+ * Select style, customize to match the website design.
41
+
42
+ [list of Styles](https://holithemes.com/plugins/click-to-chat/list-of-styles/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
43
+
44
+ ✏️ [Styles are customizable](https://holithemes.com/plugins/click-to-chat/customize-styles/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
45
 
 
46
 
47
  = 🌼 Add Own Image =
48
 
49
+ Instead of selecting a pre-defined style, add any Image/Animated-image/GIF.
50
 
51
+ = 🌈 Custom Element =
52
 
53
+ Create your own Element/Desing and just add
54
+ * Class name: 'ctc_chat' (or)
55
+ * Id name: 'ctc_chat' (or)
56
+ * Href/link: '#ctc_chat'
57
+ The custom design will navigate to WhatsApp based on plugin settings (WhatsApp Number, pre-filled message, .... ).
58
 
59
+ [Custom Element](https://holithemes.com/plugins/click-to-chat/custom-element/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
60
 
61
+ = ✳️ Position to Place =
62
+
63
+ * Add styles at any position of the screen
64
+ (not limited to fixed positions).
65
+ * Different positions for Mobile and Desktop.
66
+
67
  = ⏩ Pre-filled Message =
68
 
69
+ Text that appears at the WhatsApp chat window when the user clicks on the WhatsApp Image/button.
70
 
71
  Users can start the conversation easily.
72
 
73
  Variables to change values dynamically
74
 
75
+ **{site}** -> Website Title
76
+ **{title}** -> Page Title
77
+ **{url}** -> Web page URL
78
+ **[url]** -> Web page full URL including parameters
79
 
80
  With these variables, we can understand from which page the user started WhatsApp chat.
81
 
85
 
86
  Separate 'pre-filled message', 'call to action' settings for WooCommerce Single product pages.
87
 
88
+ Additional variables, specific to WooCommerce single product page to change values dynamically
89
 
90
+ **{product}** -> Product Name
91
+ **{price}** -> Product Price (current price)
92
+ **{regular_price}** -> Regular product price (with out any sale)
93
+ **{sku}** ->Stock keeping unit
94
 
95
  = 📒 Change Settings at page level =
96
 
97
+ At page level we can overwrite the settings. Each post we can add different Whatsapp Number, prefilled message.
 
98
  (while editing the post, at the right side bar 'Click to Chat' metabox)
99
 
100
+ * WhatsApp Number
101
+ * Call to Action
102
+ * Pre-filled Message
103
+ * Display Settings
104
+
105
  [Page level settings](https://holithemes.com/plugins/click-to-chat/change-values-at-page-level/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
106
 
107
  = 📈 Analytics =
114
 
115
  [Google Ads Conversations](https://holithemes.com/plugins/click-to-chat/google-ads-conversion/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
  = 🔆 Localization =
119
 
120
+ Click to Chat is Compatible with [WPML](https://wpml.org/), Polylang.
121
 
122
+ Easy to setup different values for each language
123
 
124
  * WhatsApp Number
125
  * Call to Action
126
+ * Pre-filled Message
127
+ * Group ID
128
+ * Share Text
129
 
130
  Setup for [WPML](https://holithemes.com/plugins/click-to-chat/translate-click-to-chat-settings-using-wpml-plugin/?utm_source=wp&utm_medium=readme&utm_campaign=ht), [Polylang](https://holithemes.com/plugins/click-to-chat/translate-click-to-chat-settings-using-polylang-plugin/?utm_source=wp&utm_medium=readme&utm_campaign=ht)
131
 
132
  = 🚀 Performance =
133
 
134
+ * Rich in features but the frontend of the site content is very light weight.
135
 
136
+ We highly concentrate on speed, performance.
137
 
138
  = 👓 Display Settings =
139
 
140
+ Show/Hide styles based on
141
+ * Post type
142
+ * Post Id
143
+ * Category name
144
+ * Device Type(Mobile, Desktop)
145
+ * WooCommerce single product pages
146
 
147
  = ⛳ Shortcodes =
148
 
192
 
193
  1. 8 Styles, 1 Add own image / GIF Style
194
  1. Chat Settings - Enter WhatsApp Number, prefilled message, call to action, desktop: web view / desktop app view
195
+ 1. Desktop settings - style, position to place (at any position of the screen)
196
+ 1. Mobile settings - style, position to place (at any position of the screen)
197
  1. Change Values at page level: 'WhatsApp Number', 'Call to action', 'Group ID'
 
198
  1. Shortcodes - add style with inline the content
199
  1. Style - 5 - Image with content box
200
  1. Style - 8 - Materialize button
206
  1. Hide on Selected pages
207
  1. Show on Selected pages
208
  1. prefilled, call to action for WooCommerce single product pages
209
+ 1. Animations
210
+ 1. Analytics - Google analytics, Facebook Pixel, Google Ads Conversations
211
 
212
 
213
  == Installation ==
386
 
387
  For any issues with the plugin / suggestions:
388
 
389
+ * 📧 ctc@holithemes.com
390
 
391
  * [WhatsApp](http://api.whatsapp.com/send?phone=919494429789&text=Hi%20HoliThemes,%20I%20have%20a%20question:)
392
 
393
+ * WordPress [new topic](https://wordpress.org/support/plugin/click-to-chat-for-whatsapp/)
394
 
395
+ * GitHub [Discussions](https://github.com/holithemes/ctc/discussions)
396
 
397
  = ⭐️ Give Support =
398
 
419
 
420
  == Changelog ==
421
 
422
+ = 3.3 =
423
+ * New: Custom Element/Design, Create an element/design and add
424
+ * Class name: ctc_chat (or)
425
+ * ID name: ctc_chat (or)
426
+ * Href/link attribute: #ctc_chat
427
+
428
  = 3.2.9 =
429
  * Performance Improvement
430
  * Fix: WooCommerce Prefilled Message Muliple lines