Skip to content
WP Engine Developers

Share Button

Share Button allows you to add a share button to your posts, making it easy for readers to share your content on social media.

Configure the platforms used within the share block modal.

Default Value:

<?php
[
'facebook' => [
'label' => 'Facebook',
'url' => 'https://www.facebook.com/sharer/sharer.php?u=%%URL%%',
'icon' => '',
],
'x' => [
'label' => 'X',
'url' => 'https://x.com/intent/tweet?url=%%URL%%',
'icon' => '',
],
'linkedin' => [
'label' => 'LinkedIn',
'url' => 'https://www.linkedin.com/sharing/share-offsite/?url=%%URL%%',
'icon' => '',
],
]

Example:

<?php
add_filter( 'mediapress_share_button_block_platforms', 'myexample_available_platforms' );
function myexample_available_platforms( $platforms ) {
// remove linkedin
unset( $platforms['linkedin'] );
$platforms['bluesky'] = [
'icon' => '',
'label' => 'BSky',
// Note: See %%URL%% to dictate where the url will be placed.
'url' => 'https://bsky.app/intent/compose?text=%%URL%%'
];
// this should be html like an svg/img tag
$platforms['x']['icon'] = '<img src="https://place-hold.it/40" />';
return $platforms;
}

Last updated: