Super simple share buttons for WordPress. No images, no css, no javascript

Overview

Developer Share Buttons

A super lightweight social sharing solution using either the Web Share API or simple sharing links.

Description

A simple, customisable share buttons solution designed specifically for theme developers.

Frequently Asked Questions

What functions are available to use?

There are 4 functions available to use:

  1. get_dev_share_buttons returns html of share links
  2. the_dev_share_buttons a wrapper just to echo get_dev_share_buttons
  3. get_dev_profile_links returns an array of the links to social pages that are saved in the admin area
  4. the_dev_profile_links echos the links as a tags in a div

get_dev_share_buttons and the_dev_share_buttons both accept 5 optional parameters:

  1. services - An array of service ids eg array( 'facebook', 'twitter', 'google' ). Defaults to the options saved on the options page
  2. url - The url to share. Defaults to value of get_the_permalink()
  3. title - The title of the item to share. Defaults to the value of get_the_title()
  4. text - The text that appears before a service title eg "Share on". Defaults to the value set on the options page.
  5. image - The url of an image to go along with the main item, only used by certain services. Defaults to the post thumbnail.

Are there default styles for this?

Yes there are! I have added some simple default styles that you can optionally enable:

add_filter( 'dev_share_buttons_css', '__return_true' );

Adding more services

You can add more services using a filter:

add_filter( 'dev_share_buttons_services', 'my_new_service' );
function my_new_service( $services ) {
  $services['myserviceid'] = array(
    'id' => 'myserviceid',
    'title' => 'My Service Title',
    'url_structure' => 'http://www.shareurl.com/?url=%1$s&title=%2$s&text=%3$s&image=%4$s',
    'url_after_title' => false
  );
return $services;
}

Adding Icons

Icons can be added via pure css or the filters provided to add content before or after the button text:

// Add an svg icon to share buttons.
function my_share_social_icons( $html, $service ) {
  $icon_url = get_stylesheet_directory_uri() . '/svg-icons.svg#' . $service['id'];
  $icon_html = '<svg><use xlink:href="' . $icon_url . '"></use></svg>';
  return $html . $icon_html;
}
add_filter( 'dev_share_buttons_after_share_text', 'my_share_social_icons', 10, 2 );

// Add a png icon to profile links.
function my_profile_social_icons( $html, $service ) {
  $icon_url = get_stylesheet_directory_uri() . '/social-icons/' . $service['id'] . '.png';
  $icon_html = '<img src="' . $icon_url . '" />';
  return $html . $icon_html;
}
add_filter( 'dev_share_buttons_after_profile_text', 'my_profile_social_icons', 10, 2 );

Enabling the Web Share API

The Web Share API is disabled by default but I recommend enabling it as it will display a single share button instead of the multiple buttons if the browser supports it. If you wish to enable this feature you can add a filter:

add_filter( 'dev_share_buttons_share_api', '__return_true' );
You might also like...
For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.
For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.

Super Admin All Sites Menu Also available at https://wordpress.org/plugins/super-admin-all-sites-menu/ Use | Prerequisite | Install | Filters | Demo |

Tailwind UI is a Tailwind CSS component library designed by the authors of Tailwind CSS
Tailwind UI is a Tailwind CSS component library designed by the authors of Tailwind CSS

Tailwind UI is a Tailwind CSS component library designed by the authors of Tailwind CSS. This is a Winter CMS plugin that provides a custom, TailwindUI-based skin for the backend.

A FREE Wordpress Plugin to compress and convert images using cwebp, jpegoptim and optipng.
A FREE Wordpress Plugin to compress and convert images using cwebp, jpegoptim and optipng.

Squidge Is FREE WordpPress Plugin built for developers in mind compressing and convert images using jpegoptim, optipng, cwebp, and libavif. It's extre

Share value objects that contain the same primitive value as a singleton

sharable-value-objects Share value objects that contain the same primitive value as a singleton. Singletons are kept under WeakReference objects. Inst

Private groups to share messages, photos, videos, links with friends and family.
Private groups to share messages, photos, videos, links with friends and family.

A truly private space for you and your friends What is Zusam ? Zusam (/tsuˈzam/) is a free and open-source way to self-host private forums for groups

Optional package for Laravel to generate social share links.

Laravel Share Share links exist on almost every page in every project, creating the code for these share links over and over again can be a pain in th

Share content between your websites.
Share content between your websites.

Distributor Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite

Arc social share - A Social Bookmarking Plugin for Textpattern

arc_social_share A Social Bookmarking Plugin for Textpattern; easily add links for sharing content with numerous social networks. arc_social_share 1.4

This composer plugin allows you to share your selected packages between your projects by creating symlinks
This composer plugin allows you to share your selected packages between your projects by creating symlinks

Composer - Shared Package Plugin This composer plugin allows you to share your selected packages between your projects by creating symlinks. All share

Comments
  • add wp shortcode functionality?

    add wp shortcode functionality?

    Awesome plugin! I don't think I see this as a feature set and if not then it would be awesome to have the ability to drop in share buttons with shortcode.

    opened by matthewselby 3
  • Use rawurlencode

    Use rawurlencode

    I'm not sure if this makes sense in all contexts. I developed an add-in share service to share the current page by email. The problem I found was that Apple's iOS email app doesn't handle mailto: urls with standard encoding -- all the spaces come out as + signs.

    Does changing the encoding to rawurlencode pose any problems for other services? Basically, the only difference is encoding spaces as %20 instead of +...

    opened by eriktdesign 1
  • Custom Share URL

    Custom Share URL

    Currently I'm using the undocumented short code [dev_share_buttons] to display share buttons. Can I somehow configure the URL that will be shared? Currently it seems to be the current page, but I would rather specify a page, is that possible?

    opened by grandeljay 0
  • Use placeholder for share text

    Use placeholder for share text

    I just found this plugin and it seems quite cool.

    I am German so "Teilen auf Facebook" doesn't really sound as good as "Auf Facebook teilen". I didn't really look at any of your code properly so I apologise for the hacky solution, I'd be willing to improve it to further suit whatever vision you have for this project.

    image

    Since you're already reading this I have some more questions I'm hoping you could answer:

    1. Is this repo still being maintained?
    2. Can this plugin be found in the WordPress plugin repo?
    3. Would you consider to rename the repo to a lowercase version (developer-share-buttons)?

    Thanks

    opened by grandeljay 0
Owner
Grant Richmond
Makes websites 'n' stuff
Grant Richmond
📦 An easy way to share the data from your backend to the JavaScript.

Laravel Shared Data ✨ Introduction Laravel Shared Data provides an easy way to share the data from your backend to the JavaScript. ?? Quick start Inst

Coderello 326 Nov 30, 2022
A web app for the resolution of a mobile game in wich you have 4 images and a list of letters, then a few boxes to fill with the word connecting the four images.

4images_1mot_solutions A web app for the resolution of a mobile game in wich you have 4 images and a list of letters, then a few boxes to fill with th

FOTSO Claude 3 Jan 13, 2022
A super simple, clean and pretty error handler that replace the default error handler of PHP. You need only include this file!

php-custom-error-handler A super simple, clean and pretty error handler that replace the default error handler of PHP. You need just include only this

null 6 Nov 7, 2022
Formulário de contato utilizando HTML, CSS, Bootstrap, PHP, Javascript e conexão ao banco de dados MySQL.

Formulário de Contato Tecnologias | Projeto | Licença | ?? Tecnologias Esse projeto foi desenvolvido com as seguintes tecnologias: HTML CSS PHP JavaSc

Douglas Duarte 3 Feb 10, 2022
aqui tienen una plantilla que pueden usar para crear paginas web, contiene html, css, javascript y php

Plantilla-html aqui tienen una plantilla que pueden usar para crear paginas web, contiene html, css, javascript y php. esta plantilla obviamente neces

PEKKA102 3 Sep 19, 2022
Medical Master or "Medic-M" was built to reduce the hassle of buying medicine, provide medicine to the sick in a short time. It is an HTML, CSS, JAVASCRIPT and PHP based system.

Medical Master (Medic-M) | WELCOME TO Medic-M(MEDICAL MASTER) | | Introduction | Medical Master or "Medic-M" was built to reduce the hassle of buying

NILOY KANTI PAUL 5 Oct 8, 2022
A real-time chatting website using HTML, CSS, JavaScript, PHP

ChatApp A real-time chatting website using HTML, CSS, JavaScript, PHP #Features Signup Login Signup & Login Validation Encrypted Password Realtime Mes

Suraj Sahu 6 Oct 18, 2022
Wake PC is a super tiny password protected webapp for linux machines that sends WOL packets, written in PHP.

Wake PC Wake PC is a super tiny password protected webapp for linux machines that sends WOL packets, written in PHP. How to set up Quick setup You can

Dániel Szabó 45 Dec 30, 2022
Lite version of STY, Super Typecho

STY Lite Lite version of STY, Super Typecho 因为STY的正确策略,对于主题部件的修改非常容易,这是在几个小时内诞生的Lite版本 STY lite版本,这是体验版本,体验版本也有一个特殊的名字:stylite -- 修行者 带着开源,修行吧! 关于主题 S

Wibus 8 Mar 2, 2022
RedeemeRadio is the radio station of Alexander Schliker, our Redeemer and Super Hero (he actually flies).

RedeemeRadio - README Welcome to the RedeemeRadio project -- an open source project for allowing broadcasting the radio of Alexander Schliker, our Sup

RedeemeRadio 1 Nov 21, 2021