• Hi Greg Thanks for your help
    Is it possible to add a contact button by WhastApp automatically?
    In other words, the button to contact by WhatsApp should be in all the ads that the advertiser has.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hii,
    it is possible, but how to do that depends on where you would like to add this button exactly? Inside the “Show Contact Information” box, next to the contact form button or somewhere else?

    Thread Starter alexrick

    (@alexrick)

    Hi Greg
    Yes Inside the “Show Contact Information” box

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    ok, to do that you would need to add the below code in your theme functions.php file

    
    add_action( "adverts_tpl_single_bottom", function() {
        remove_action( "adverts_tpl_single_bottom", "adverts_single_contact_information_box", 2000 );
        add_action( "adverts_tpl_single_bottom", "my_adverts_single_contact_information_box", 2000 );
    }, 100 );
    function my_adverts_single_contact_information_box( $post_id ) {
    
        ?>
        <div class="adverts-contact-box adverts-contact-box-toggle">
            <p class="adverts-contact-method">
                <span class="adverts-icon-phone adverts-contact-icon" title="<?php _e("Phone", "adverts") ?>"></span>
                <span class="adverts-contact-phone"></span>
            </p>
    
            <p class="adverts-contact-method">
               <span class="adverts-icon-mail-alt adverts-contact-icon" title="<?php _e("Email", "adverts") ?>"></span>
               <span class="adverts-contact-email"></span>
            </p>
    
            <p class="adverts-contact-method">
               <span class="adverts-icon-whatsapp adverts-contact-icon" title="<?php _e("WhatsApp", "adverts") ?>"></span>
               <span class="adverts-contact-whatapp"><?php echo esc_html( get_post_meta( $post_id, "whatsapp", true ) ) ?></span>
            </p>
        </div>
        <?php
    }
    

    I understand that the whatsapp number you are storing in the [adverts_add] form as a custom field so in the above code in the line get_post_meta( $post_id, "whatsapp", true ) you would need to replace “whatsapp” with the actual field name which stores the number.

    Please note that while the email and phone number are loaded via AJAX (so are somewhat protected from harvester collecting contact details) the WhatsApp is always shown on page, although i am not sure if the WhatsApp numbers are used for sending spam.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WhatsApp button’ is closed to new replies.