Skip to:
Content
Pages
Categories
Search
Top
Bottom

Whatsapp me Button


  • vimal05
    Participant

    @vimal05

    Hi im stuck to create a button on buddy press user profile to which on click opens up wtasapp to start a conversations.

    I need a button with ref to > https://wa.me/{user number}, were on click, the user phone number will be retrieved and appended to the link above.

    Ive managed to add a custom button using

    function buddydev_add_custom_buttons( $buttons ) {

    if ( ! bp_is_my_profile() ) {
    return $buttons;
    }

    $buttons[‘contact’] = array(
    ‘id’ => ‘buddydev_contact’,
    ‘component’ => ‘members’,
    ‘must_be_logged_in’ => true,
    ‘button_element’ => ‘a’,
    ‘link_text’ => __( ‘Contact me’ ),
    ‘button_attr’ => array(
    ‘href’ => esc_url( ‘https://wa.me/{user number}’ ),
    ‘title’ => __( ‘Contact Me’ ),
    )
    );

    return $buttons;
    }

    add_filter( ‘bp_nouveau_get_members_buttons’, ‘buddydev_add_custom_buttons’ );

  • You must be logged in to reply to this topic.
Skip to toolbar