itinerisltd/socialus

Straight to the point social sharing links for your WordPress theme

0.1.0 2021-06-10 09:25 UTC

This package is auto-updated.

Last update: 2024-04-10 16:23:42 UTC


README

Packagist Version PHP from Packagist Packagist Downloads GitHub License Hire Itineris

Goal

Socialus makes sharing pages to social networks dead simple.

Installation

Traditional WordPress Theme

Require the package into your theme with Composer with:

$ composer require itinerisltd/socialus

Render the output!

<?php
$socialus = new \Itineris\Socialus\Socialus();
echo $socialus->render();

Sage

Require the package into Sage:

$ composer require itineris/socialus -o

Add it to a Controller:

# sage/app/Controllers/App.php
<?php
namespace App\Controllers;

use Sober\Controller\Controller;
use Itineris\Socialus\Socialus;

class App extends Controller
{
    public function socialus()
    {
        return new Socialus();
    }
}

Finally, render the output into your Blade template:

{!! $socialus->render() !!}

Usage

Removing a site

<?php
$socialus = new Socialus();
$socialus->removeSite('facebook');

Adding a site

<?php
$socialus = new Socialus();
$data = [
    'link' => 'https://reddit.com/submit',
    'params' => [ // these are to tell Socialus how to share
        'url' => 'url',
        'title' => 'title',
    ],
    'label' => 'Reddit',
    'icon' => 'fa fa-reddit',
    'image' => '', // optional if icon is set
];
$socialus->addSite('reddit', $data);

Change elements and classes

$socialus = new Socialus([
    'container_element' => 'div',
    'container_class' => 'socials',
    'item_element' => 'span',
    'item_class' => 'social-item',
    'link_class' => 'social-item-link',
]);

Use icons or images

$socialus = new Socialus([
    'type' => 'icon',
    'screen_reader_class' => 'screen-reader',
]);
$socialus_2 = new Socialus([
    'type' => 'image',
]);

FAQs

Will you add support for older PHP versions?

Never! This plugin will only works on actively supported PHP versions.

Don't use it on end of life or security fixes only PHP versions.

It looks awesome. Where can I find some more goodies like this?

This isn't on wp.org. Where can I give a ⭐️⭐️⭐️⭐️⭐️ review?

Thanks! Glad you like it. It's important to make my boss know somebody is using this project. Instead of giving reviews on wp.org, consider:

Feedback

Please provide feedback! We want to make this library useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.

Change Log

Please see CHANGELOG for more information on what has changed recently.

Security

If you discover any security related issues, please email hello@itineris.co.uk instead of using the issue tracker.

Credits

Socialus is a Itineris Limited project created by Lee Hanbury-Pickett.

Full list of contributors can be found here.

License

Socialus is licensed under the MIT License. Please see License File for more information.