Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wp-digital/wp-block-social-share

Links to share current post to most used social such as Facebook, Twitter, Email, LinkedIn.
https://github.com/wp-digital/wp-block-social-share

block gutenberg-blocks social-share wordpress-plugin

Last synced: about 1 month ago
JSON representation

Links to share current post to most used social such as Facebook, Twitter, Email, LinkedIn.

Awesome Lists containing this project

README

        

# Social Share Block

### Description

Links to share current post to most used social such as Facebook, Twitter, Email, LinkedIn.

### Demo

[Social Share Block](https://demo.wpd.digital/social-share-block/)

### Install

- Preferable way is to use [Composer](https://getcomposer.org/):

````
composer require wp-digital/wp-block-social-share
````

- Alternate way is to clone this repo to `wp-content/plugins/`:

````
cd wp-content/plugins/
git clone [email protected]:wp-digital/wp-block-social-share.git
````

Activate **Social Share Block** with [WP-CLI](https://make.wordpress.org/cli/handbook/)
`wp plugin activate wp-block-social-share` or from **Plugins** page.

### Documentation

Add, change or remove social with hook `wpd-block-social-share-socials`. If new social
added then its URL needs to be implemented via `wpd-block-social-share-$social-url` filter. **Example**:

````
add_filter( 'wpd-block-social-share-socials', function ( array $socials ) : array {
unset( $socials['linkedin'] );

$socials['pinterest'] = [
'label' => esc_html__( 'Share on Pinterest', 'your-text-domain' ),
'icon' => '',
];

return $socials;
} );
````

````
add_filter( 'wpd-block-social-share-pinterest-url', function ( string $url, int $post_id ) : string {
return add_query_arg( [
'url' => get_the_permalink( $post_id ),
'description' => get_the_title( $post_id ),
], 'https://pinterest.com/pin/create/button/' );
}, 10, 2 );
````