Home Support Themes ListingHive how to set link whatsapp

how to set link whatsapp

  • Author
    Posts
  • zsmaesa

    Hi,

    Please create a new text attribute in Listings/Attributes section, mark it as editable and required, and assign it to the “Page (primary)” area. Also, set this in the Regex pattern field:

    \d+

    It will allow numbers only. Then set this in the display format field:

    <a href="https://wa.me/%value%">Chat via WhatsApp</a>

    Then if this attribute is set for a listing, there will be a WhatsApp button.

    (there is no option regex pattern and what is the field type is it URI )
    thank you

    ihor developer

    Hi,

    It’s available for Text attributes, please try selecting the Text type and then set a Regex Pattern to restrict the user input.

    zsmaesa

    to restrict the user input how sorry Im new 🙁

    zsmaesa

    I’m from Malaysia started number 60108765654

    zsmaesa

    /^(\+?6?01)[0|1|2|3|4|6|7|8|9]\-*[0-9]{7,8}$/
    can’t

    ihor developer

    Sorry, I can’t help you with a custom Regex pattern, please try using the simple pattern from the suggested topic (to allow numbers only), if you want to set a more complex pattern you can test it here https://www.phpliveregex.com/ or ask on StackOverflow.

    kandwal

    sir how to add green color in background where to put color code

    ihor developer

    If you mean the button background you can set some unique CSS class for it and then customize it via a custom CSS snippet, or you can try a display format like this:

    <a href="https://wa.me/%value%" style="background-color:green">Chat via WhatsApp</a>

    But I haven’t tested it.

    capitalss2

    @ihor I tried it didn’t work it comes out this text “We can’t find the page you’re looking for” and I noticed it opens the page api.whatsapp.com is there a js code snippet for opening a user’s number in the WhatsApp app

    gabetu

    It’s working on mobile but you need to have full number including country code, example for an Italian number:
    <a href="https://wa.me/00393333333333" rel="nofollow">Chat via WhatsApp</a>

    capitalss2

    @gabetu Thank you very much friend it works but how do I put the number instead of the number %value%

    gabetu

    Well, you need to ask your users (and you can manage the min / max digits in attribute settings):
    1. To enter full phone number including the country code:
    <a href="https://wa.me/%value%" style="background-color:green">Chat via WhatsApp</a>
    2. To enter only the mobile number (0039 is Italy code):
    <a href="https://wa.me/0039%value%" style="background-color:green">Chat via WhatsApp</a>

    capitalss2

    @gabetu Thank you but the 1 and 2 method does not work we have the country code +7 but in the field type number is not+, by the way the country code of Italy +39 is the same

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.