Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing: Add WhatsApp-Sharebuttons #3225

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/sharedaddy/admin-sharing.js
Expand Up @@ -123,7 +123,7 @@
$( '#live-preview div.sharedaddy' ).addClass( 'sd-social-icon' );
} else if ( 'official' === button_style ) {
$( '#live-preview ul.preview .advanced, .sharing-hidden .inner ul .advanced' ).each( function( /*i*/ ) {
if ( !$( this ).hasClass( 'preview-press-this' ) && !$( this ).hasClass( 'preview-email' ) && !$( this ).hasClass( 'preview-print' ) && !$( this ).hasClass( 'share-custom' ) ) {
if ( !$( this ).hasClass( 'preview-press-this' ) && !$( this ).hasClass( 'preview-email' ) && !$( this ).hasClass( 'preview-print' ) && !$( this ).hasClass( 'preview-whatsapp' ) && !$( this ).hasClass( 'share-custom' ) ) {
$( this ).find( '.option a span' ).html( '' ).parent().removeClass( 'sd-button' ).parent().attr( 'class', 'option option-smart-on' );
}
} );
Expand Down Expand Up @@ -346,7 +346,7 @@
// Add focus
nextSibling.next().focus();
}

//Save changes
save_services();
}
Expand All @@ -370,7 +370,7 @@

// Move it to the appropriate area and add focus back to service
$( '.' + dropzone ).prepend( thisService ).find( 'li:first-child' ).focus();

//Save changes
save_services();
}
Expand Down
1 change: 1 addition & 0 deletions modules/sharedaddy/sharing-service.php
Expand Up @@ -55,6 +55,7 @@ public function get_all_services( $include_custom = true ) {
'tumblr' => 'Share_Tumblr',
'pinterest' => 'Share_Pinterest',
'pocket' => 'Share_Pocket',
'whatsapp' => 'Share_WhatsApp',
);

if ( $include_custom ) {
Expand Down
18 changes: 18 additions & 0 deletions modules/sharedaddy/sharing-sources.php
Expand Up @@ -1601,3 +1601,21 @@ function jetpack_sharing_pocket_init() {
}

}

class Share_WhatsApp extends Sharing_Source {
public $shortname = 'whatsapp';
public $genericon = '\f224';

public function __construct( $id, array $settings ) {
parent::__construct( $id, $settings );
}

public function get_name() {
return __( 'WhatsApp', 'jetpack' );
}

public function get_display( $post ) {
return $this->get_link( 'whatsapp://send?'. rawurlencode( $this->get_process_request_url( $post->ID ) ), _x( 'WhatsApp', 'share to', 'jetpack' ), __( 'Click to share on WhatsApp', 'jetpack' ) );
}
}