Pipit Sharing 1.2

v1.1

I failed to announce the changes added to v1.1 (which was released in Januray). This version adds support for email sharing links (mailto) and WhatsApp sharing links.

Basic usage:

<a href="<perch:sharing id="email" />" >Email to a friend</a>
<a href="<perch:sharing id="whatsapp" />" >Share on WhatsApp</a>

More details in the docs.

v1.2

By default Pipit Sharing uses the URL of the current page. So if you add sharing links to an item and display the item on its actual page, it automatically gets the URL of the page.

However, if you add the item on another page and include sharing links on there too, Pipit Sharing will use the URL of this page rather than the actual item page.

Now you can tell Pipit Sharing what URL you want it to include using sharing_item_url.

Here’s a basic blog listing:

perch_blog_custom([
    'template' => 'post_in_list.html',
    'sort' => 'postDateTime',
    'sort-order' => 'DESC',
    'count' => 9,
    'paginate' => true,
]);

If you want to include sharing links in your blog listings to each post in post_in_list.html, you need to set sharing_item_url like so:

perch_blog_custom([
    'template' => 'post_in_list.html',
    'sort' => 'postDateTime',
    'sort-order' => 'DESC',
    'count' => 9,
    'paginate' => true,
    'each' => function($item) {
        $item['sharing_item_url'] = $item['postURL'];
        return $item;
    }
]);

This also works for other types of listings such as Shop products, Collections and multi-item regions. For more details check out the examples in the docs.

link