• Resolved lipe2017

    (@lipe2017)


    Good afternoon, first I come to thank you for the plugin that in my opinion is what I liked the most, I’m looking for and I’m not finding the WhatsApp option here, just the phone, I would like to use this API for example: https: // api. whatsapp.com/send?phone=9999999
    to open directly by whatsapp could someone give a help?

    Thank you very much in advance.

Viewing 1 replies (of 1 total)
  • Plugin Support Rafiz Sejim

    (@rafizsejim)

    Hello @lipe2017

    Thank you for reaching us

    I am sorry to let you know it is not possible by default. You need to opt-in for custom development for that. However, in this instance, you can use the following snippet to switch the “Phone” field to WhatsApp link.

    Add the following snippet in your functions.php

    function directorist_custom_whatsapp() {
    wp_enqueue_script( 'jquery' );
    ?>
    <script>
      jQuery(document).ready(function($){
    
        $(".atbd_contact_info ul li").children().each(function() {
          if ($(this).is(":contains('Phone')")) {
            	$(this).children().addClass('fa-whatsapp').removeClass('fa-phone').css({'font' : 'normal normal 900 16px/2 "Font Awesome 5 Brands"'});
                 var whatsappNumber = $(this).next().text();
            	 var selectwaNumber = $(this).next().children();
                 selectwaNumber.attr('href', 'https://wa.me/'+ $.trim(whatsappNumber));
            	 selectwaNumber.attr('target', '_blank'); 	
          }
        });
    });
    </script>
    
    <?php
    }
    add_action( 'wp_footer', 'directorist_custom_whatsapp');

    Regards,

    • This reply was modified 3 years, 11 months ago by Rafiz Sejim.
Viewing 1 replies (of 1 total)
  • The topic ‘Open by Whatsapp, help!’ is closed to new replies.