2022-11-29 22:17:34 +01:00
=== Include Mastodon Feed ===
Contributors: wolfgang101
2023-07-05 19:20:10 +02:00
Donate link: https://www.buymeacoffee.com/w101
2022-11-29 22:17:34 +01:00
Tags: mastodon, status, feed
Requires at least: 6.0
2025-03-18 18:57:42 +01:00
Tested up to: 6.8
2022-11-29 22:17:34 +01:00
Requires PHP: 7.4
2025-05-16 12:24:18 +02:00
Stable tag: 1.13.1
2024-11-23 22:40:25 +01:00
License: MIT
2022-11-29 22:17:34 +01:00
License URI: https://directory.fsf.org/wiki/License:Expat
Plugin that provides a shortcode to easily integrate mastodon feeds into wordpress pages.
== Description ==
2024-06-20 16:56:27 +02:00
Plugin that provides an `[include-mastodon-feed]` shortcode to easily integrate mastodon feeds into wordpress pages. Supports personal and tag feeds.
2022-11-29 22:17:34 +01:00
2025-05-15 14:26:37 +02:00
Account and post images are lazy loaded if preserveImageAspectRatio is set to true (default: false).
2025-05-07 16:19:53 +02:00
2022-11-29 22:17:34 +01:00
The plugin is written in PHP and generates native JavaScript to fetch and render the mastodon feed. No special libraries needed.
== Installation ==
1. Upload the "include-mastodon-feed" directory to the "/wp-content/plugins/" directory.
1. Activate the plugin through the "Plugins" menu in WordPress.
1. Insert shortcode into any page.
= Shortcode example =
`[include-mastodon-feed instance="YOUR-INSTANCE" account="YOUR-ACCOUNT-ID"]`
= Shortcode attributes =
2024-11-23 22:40:25 +01:00
* **instance** (required)
Domain name of the instance without https:// (e.g. example.org)
2022-11-29 22:17:34 +01:00
* **account** (required)
The account ID (a long number - see FAQ on how to get it)
2024-06-20 16:56:27 +02:00
* **tag**
Use **tag** instead of **account** if you want to embed a tag feed instead of a personal feed
2022-12-09 15:36:17 +01:00
* **limit**
Maximum number of statuses (Default: 20)
2022-12-07 22:47:42 +01:00
* **excludeReplies**
Exclude replies to other accounts (Default: false)
2023-06-23 20:22:24 +02:00
* **excludeConversationStarters**
Exclude statuses that start with a user mention (Default: false)
2022-12-07 17:12:35 +01:00
* **excludeBoosts**
Exclude boosted statuses (Default: false)
2022-12-07 22:47:42 +01:00
* **onlyPinned**
Show only pinned statuses (Default: false)
* **onlyMedia**
Show only statuses containing media (Default: false)
2024-06-20 16:56:27 +02:00
* **preserveImageAspectRatio**
Preserve image aspect ratio (Default: false)
2024-11-16 01:03:41 +01:00
* **imageSize**
Load small sized preview images or full size high quality images (Default: preview, full)
2024-11-16 02:10:14 +01:00
* **imageLink**
Link image to status or image (Default: status, image)
2022-12-09 14:55:36 +01:00
* **tagged**
Show only statuses that are tagged with given tag name (Default: false)
No leading #, case insensitive, e.g.: tagged="tagname"
2022-12-09 15:18:39 +01:00
* **linkTarget**
Target for all links e.g. new tab would be "_blank" (Default: _self)
2023-05-02 15:23:24 +02:00
* **showPreviewCards**
Show preview cards (Default: true)
2024-06-20 16:56:27 +02:00
* **hideStatusMeta**
Hide status meta information, automatically also hides date and time (Default: false)
* **hideDateTime**
Hide date and time from status meta information (Default: false)
2022-11-29 22:17:34 +01:00
* **darkmode**
Enable dark mode (Default: false)
2022-12-03 23:24:07 +01:00
* **text-loading**
Loading text (Default: Loading Mastodon feed...)
2023-06-23 21:36:00 +02:00
* **text-noStatuses**
Text if no statuses are available (Default: No statuses available)
2022-12-03 23:24:07 +01:00
* **text-boosted**
Text indicating boosted statuses (Default: boosted 🚀)
* **text-viewOnInstance**
View status on instance link text (Default: view on instance)
2022-12-07 17:01:50 +01:00
* **text-showContent**
Text for content warning buttons (Default: Show content)
2023-04-09 14:02:31 +02:00
* **text-permalinkPre**
Text before post permalink (date & time) (Default: on)
* **text-permalinkPost**
Text after post permalink (date & time) (Default: )
* **text-edited**
Text indicating edited posts (Default: (edited))
2025-01-24 12:29:59 +01:00
* **date-locale**
Locale for date string, used in toLocaleString() (Default: en-US)
2022-11-29 22:17:34 +01:00
= Additional customizations =
2025-01-24 12:24:42 +01:00
You can define several plugin constants to set custom default options that will be applied site-wide (e.g. date options can only be set as php constant to mitigate an XSS vulnerability).
2022-11-29 22:17:34 +01:00
2022-12-08 00:28:27 +01:00
1. Open your `wp-config.php` file
2. Search for the line `/* Add any custom values between this line and the "stop editing" line. */`
3. Define the options you want to override between the line from step #2 and `/* That's all, stop editing! Happy publishing. */`
See the included `config-example.php` file for a full list of supported settings.
2022-11-29 22:17:34 +01:00
== Frequently Asked Questions ==
= How do I find my account ID? =
2024-08-24 15:16:59 +02:00
Please feel free to use [this handy lookup tool](https://wolfgang.lol/code/include-mastodon-feed-wordpress-plugin/)
To look your ID up manually there are several ways.
2022-11-29 22:17:34 +01:00
As an instance admin you can easily read your user ID in the admin backend.
As regular user you can try an API v2 search to find your ID.
**API v2 notes:**
* Change `example.org` to your instance
* Replace `username` with your handle.
Use the following URL to get your ID:
2024-08-24 15:16:59 +02:00
`https://example.org/api/v2/search?q=username@example.org&resolve=false&limit=5`
2022-11-29 22:17:34 +01:00
2022-12-03 23:24:07 +01:00
= Known Issues / Todo =
2022-12-08 02:28:04 +01:00
* improve support for video and audio media attachment types
2023-05-02 15:05:48 +02:00
* integrate i18n into translate.wordpress.org instead of text constants
2023-04-09 14:02:31 +02:00
* re-build plugin as custom gutenberg block
2022-11-29 22:17:34 +01:00
== Screenshots ==
* No screenshots
== Changelog ==
2025-05-16 12:24:18 +02:00
= 1.13.1 =
* fix: removed unnecessary, broken aria-label functionality
2025-05-15 14:26:37 +02:00
= 1.13 =
Special release for Global Accessibility Awareness Day
in collaboration with @oldrup@mastodon.green
Happy [Accesssibility Day](https://accessibility.day)
* accessibility (fix): image alt attributes - initial implementation was faulty
2025-05-15 16:10:47 +02:00
* accessibility: added alt text to image / gifv attachments
2025-05-15 14:26:37 +02:00
* accessibility: added alt text to avatar images
2025-05-15 16:10:47 +02:00
* accessibility: added alt text to preview card media
* accessibility: added descriptive aria-labels
2025-05-15 14:26:37 +02:00
* accessibility: increased default text / background color contrast
2025-05-15 15:47:28 +02:00
* accessibility: switched from DIV to semantic OL / LI structure
2025-05-15 14:26:37 +02:00
2025-05-09 12:09:25 +02:00
= 1.12 =
* accessibility: added image alt attribute (thank you @oldrup@mastodon.green)
2025-05-08 11:57:40 +02:00
= 1.11 =
* now favoring preview_url (smaler size) instead of remote_url (full size) for image previews (thank you @oldrup@mastodon.green)
2025-05-07 16:19:53 +02:00
= 1.10 =
2025-05-07 16:27:09 +02:00
* added image lazy loading for account and post images - post image lazy loading only works with preserveImageAspectRatio set to true (thank you @oldrup@mastodon.green)
2025-05-07 16:19:53 +02:00
2025-01-27 14:48:14 +01:00
= 1.9.11 =
2025-04-16 19:53:07 +02:00
* fixed typo (thank you @hjek)
2025-01-27 14:48:14 +01:00
* cleaned up code after 1.9.10 release
2025-01-24 12:24:42 +01:00
= 1.9.10 =
2025-01-24 12:29:59 +01:00
* fixed XSS vulnerability: removed support for date-options as shortcode attribute completely - to mitigate an XSS vulnerability where authenticated attackers with contributor permission could insert malicious JavaScript (still can be set as constant in PHP code)
2025-01-24 12:24:42 +01:00
2024-11-24 17:50:04 +01:00
= 1.9.9 =
* fixed esc_url context that previously broke the URL for the Mastodon API JS ajax request (thank you @beach@illo.social)
2024-11-23 22:40:25 +01:00
= 1.9.8 =
2024-11-23 22:51:24 +01:00
* fix broken date-locale and date-options parameters (thank you @crusy@chaos.social)
2024-11-23 22:40:25 +01:00
* improved string excaping for text parameters and added url escaping
* removed unnecessary output buffering
* fix license SPDX Identifier
2024-11-22 11:43:33 +01:00
= 1.9.7 =
* fix option to either display smaller image media attachment previews (default) or large image versions (thank you @beach@illo.social)
2024-11-20 14:21:06 +01:00
= 1.9.6 =
* fixed XSS vulnerability where authenticated attackers with contributor permissions could insert malicious JavaScript
2024-11-16 01:03:41 +01:00
= 1.9.5 =
2024-11-22 11:43:33 +01:00
* added option to either display smaller image media attachment previews (default) or large image versions (thank you @beach@illo.social)
2024-11-16 02:10:14 +01:00
* added option to point image media attachment links to either status (default) or image
2024-11-16 01:03:41 +01:00
2024-06-20 16:56:27 +02:00
= 1.9.4 =
* added option to hide status meta information and date/time (thank you @PaulKingtiger@dice.camp)
* added tag support - you can now embed tag feeds (thank you @martin@openedtech.social)
* added option to show embedded images in original aspect ratio (thank you @beach@illo.social)
* fix: correctly inject repeating emojis in display names and status texts (thank you @kanigsson@discuss.systems)
2023-10-13 13:18:26 +02:00
= 1.9.3 =
* fix: improved excludeConversationStarters detection (did not work correctly)
* fix: undid last refactor to load JS inline with markup instead footer to fix problem with JS that was added to footer even if shortcode was not visibly rendered
2023-07-05 13:31:14 +02:00
= 1.9.2 =
* fix: style for embedded videos / GIFs
* refactor: play gifv on mouseover
2023-08-14 21:44:59 +02:00
* refactor: load markup related javascript in footer instead of embedding it directly with the html markup
2023-07-05 13:31:14 +02:00
= 1.9.1 =
* refactor: show meaningful message if no statuses are available
* fix: broken excludeConversationStarters logic
2023-06-23 20:22:24 +02:00
= 1.9.0 =
* added option to exclude conversation starters (posts that start with a user mention)
2023-06-23 19:22:17 +02:00
= 1.8.1 =
* fix: boolean param validation was wonky
* fix: stop links from overflowing (thanks to https://github.com/moan0s for contributing)
* refactoring: improved styling of embedded images
2023-05-02 15:05:48 +02:00
= 1.8.0 =
2023-05-02 15:23:24 +02:00
* added option to show/hide preview cards
2023-05-02 15:05:48 +02:00
* refactoring: introducing plugin namespace
2023-05-02 15:26:54 +02:00
* refactoring: improved debug console output
2023-05-02 15:05:48 +02:00
2023-04-09 14:02:31 +02:00
= 1.7.0 =
* bumped tested wordpress version to 6.2
* added option to customize permalink text (before and after date/time)
* added option to customize text indicating edited posts
2023-02-22 13:58:55 +01:00
= 1.6.0 =
* image attachments are now clickable (link to original status)
2022-12-09 14:55:36 +01:00
= 1.5.0 =
* added option to show only statuses with specific tag
2022-12-09 15:18:39 +01:00
* added option to set link target to make links open in new tab
2022-12-09 15:36:17 +01:00
* added option to set maximum number of statuses
2022-12-09 14:55:36 +01:00
2022-12-08 10:09:01 +01:00
= 1.4.2 =
* fixed styling issue with emojis in account display name
2022-12-08 02:40:59 +01:00
= 1.4.1 =
* fixed styling issue with boosted account links
2022-12-08 02:28:04 +01:00
= 1.4.0 =
* removed "view on instance" link and made date info clickable instead
* added custom date locale and format option
* fixed emoji and inline link styling issues in content blocks
* fixed an issue with gifv media attachments
* refactored option sanitizing and filtering
2022-12-08 00:28:27 +01:00
= 1.3.1 =
* updated documentation that plugin constants for setting custom default options have to be defined in `wp-config.php`, as the previous config.php file gets removed with every automatic plugin update
* removed `config.php` support
2022-12-07 22:47:42 +01:00
= 1.3.0 =
* added new feed options: excludeReplies, onlyPinned, onlyMedia
2022-12-07 16:42:26 +01:00
= 1.2.0 =
2022-12-08 02:28:04 +01:00
* fixed broken JavaScript if post included media attachments other than images
2022-12-07 17:01:50 +01:00
* fixed custom "view on instance" option
* added option for custom content warning button text
2022-12-07 17:12:35 +01:00
* added option to exclude boosted statuses
2022-12-07 16:42:26 +01:00
* added support for gifv media attachments
2022-12-03 23:24:07 +01:00
= 1.1.0 =
2022-12-03 23:32:02 +01:00
* added support for more custom text overrides (loading, boosted, view on instnace)
2022-12-03 23:24:07 +01:00
* switched to showing static avatars, animated avatars only on hover
2022-12-02 11:22:04 +01:00
= 1.0.1 =
* escaped options when echoing them
* secured local file inclusion
* changed versioning to semantic versioning - now including patch number
2022-11-29 22:17:34 +01:00
= 1.0 =
2022-12-03 23:32:02 +01:00
* Initial release
== Upgrade Notice ==
2023-06-23 20:22:24 +02:00
= 1.8.1 =
* minor style updates - if you have custom styling make sure to check if all is good
2022-12-08 00:28:27 +01:00
= 1.3.1 =
* plugin constants for setting custom default options have to be defined in `wp-config.php`, as the previous config.php file gets removed with every automatic plugin update
2022-12-03 23:32:02 +01:00
= 1.1.0 =
* "loading" shortcode attribute was renamed to "text-loading"