support@wpsupportservices.co.uk
0330 22 33 458

WPTavern: Embed Mastodon Statuses in WordPress

WPTavern: Embed Mastodon Statuses in WordPress

After the controversial changes to Twitter’s @reply feature, which no longer counts usernames towards the 140-character limit, Mastodon registrations rose sharply. Mastodon is a free, open source, decentralized network that has many similarities to Twitter. The software, named in honor of its creator’s favorite metal band, was launched in October and registered 24,000 users in the first six months. A strong negative reaction to Twitter’s changes has fueled a spike in Mastodon registrations. In the last week alone, the software’s user base has grown from 237,000 users on April 15 to more than 414,000 users today.

Mastodon is different from Twitter in that it is broken up into different independently-hosted instances. Whereas Twitter has struggled to combat trolls and abuse on its platform, Mastodon instances can each declare and enforce their own rules. For example, the flagship Mastodon.social instance bans content that is illegal in Germany or France, such as Nazi symbolism and Holocaust denial, excessive advertising, racism, sexism, and other undesirable posts.

Mastodon’s Tweetdeck-style interface allows users to post “toots” with a 500-word character limit. Toots can also be published with a content warning so that users can choose whether to view it.

With all the increased activity around Mastodon this week, there was bound to be someone with the desire to display toots on their website. The first plugin for bringing Mastodon content into WordPress has landed in the plugin directory. Embed Mastodon was created by David Libeau, a French developer and Mastodon enthusiast. It allows users to embed toots using a shortcode.

“I created this plugin because Numerama, a french tech website, was saying that it could be cool to embed Mastodon statuses, like with Twitter, in WordPress,” Libeau said. “I was thinking the same when I wrote a small article on my personal blog. I am using both Twitter and Mastodon but want to progressively leave Twitter.”

Libeau said he is not a WordPress developer and Mastodon Embed is his first plugin. He does not know if it’s coded well but said users may be interested in an alternative plugin on GitHub that is a complete rewrite of his effort. The rewrite includes multiple embeds, caching, proper shortcode initialization, and fallback to “direct” embeds if embed via iframe is forbidden.

Libeau said he doesn’t know what will happen to his plugin in light of the rewrite, but he is continuing to develop small tools for Mastodon users. Mastodon has an open API for apps and services, which makes it easy for developers to build things that integrate with it.

After testing the Mastodon Embed plugin I found that it works but may have a couple of styling issues with the link display. If you find that it’s not working, it’s possible that your particular Mastodon instance configuration does not allow embedding via iFrame. To resolve this you may need to contact the admin of the instance or use the fork of the plugin that has a fallback for this scenario. If you find a bug with the Mastodon Embed plugin hosted on WordPress.org, you can log an issue on Libeau’s Mastodon Tools repository.



Source: WordPress

Add a Comment