Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    You can add the following code inside the child theme’s functions.php

    add_action( ‘bp_share_user_services’, ‘wbcom_add_new_service’, 10, 3 );

    function wbcom_add_new_service( $services, $activity_link, $activity_title ) {

    $services = array
    (
    ‘chb_bp_share_whatsapp’ => 1,
    ‘service_name’ => ‘Whatsapp’,
    ‘service_icon’ => ‘fa fa-whatsapp’,
    ‘service_description’ => ‘Facebook is an American for-profit corporation and online social media and social networking service based in Menlo Park, California, United States’
    ) ;
    echo ‘<span class=”fa-stack fa-lg”><i class=”‘ . $services[ ‘service_icon’ ] . ‘”></i></span>‘;
    }

    • This reply was modified 5 years, 4 months ago by Pooja Sahgal.
    Thread Starter teeboy4real

    (@teeboy4real)

    Hello,

    Thanks for the code but it broke my site immediately after being applied to my child theme’s functions.php file

    Hello @teeboy4real,
    Paste these lines of code in your child theme’s functions.php

    
    add_action( 'bp_share_user_services', 'wb_add_watsap_share', 10, 3 );
    function wb_add_watsap_share( $services, $activity_link, $activity_title ) {
    	echo '<a target="blank" class="bp-share bps-mobile-display" href="https://api.whatsapp.com/send?text='. $activity_link . '&image_sharer=1" data-action="share/whatsapp/share" rel="whatsapp"><span class="fa-stack fa-lg"><i class="fa fa-whatsapp"></i></span></a>';
    	echo '<a target="blank" class="bp-share bps-desktop-display" href="https://web.whatsapp.com/send?text='. $activity_link . '&image_sharer=1" data-action="share/whatsapp/share" rel="whatsapp"><span class="fa-stack fa-lg"><i class="fa fa-whatsapp"></i></span></a>';
    }
    

    And these lines in your css file.

    .bps-desktop-display {
    display: inline-block;
    }
    .bps-mobile-display {
    display: none;
    }
    .fa-whatsapp {
    color: #5cbc2e;
    }
    @media( max-width: 767px ) {
    .bps-mobile-display {
    display: inline-block!important;
    }
    .bps-desktop-display {
    display: none!important;
    }
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add support for whatsapp’ is closed to new replies.