2022-11-29 22:20:16 +01:00
|
|
|
# Include Mastodon Feed Wordpress Plugin
|
2022-11-25 22:19:00 +01:00
|
|
|
|
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-25 22:23:46 +01:00
|
|
|
|
|
|
|
The plugin is written in PHP and generates native JavaScript to fetch and render the mastodon feed. No special libraries needed.
|
2022-11-25 22:19:00 +01:00
|
|
|
|
|
|
|
## Table of contents
|
|
|
|
* [Usage](#usage)
|
|
|
|
* [Supported shortcode attributes](#supported-shortcode-attributes)
|
|
|
|
* [Additional customization](#additional-customizations)
|
2022-11-25 22:51:44 +01:00
|
|
|
* [Installation](#installation)
|
|
|
|
* [Installation via ZIP file](#installation-via-zip-file)
|
|
|
|
* [Installation via git checkout](#installation-via-git-checkout)
|
2022-11-25 23:52:15 +01:00
|
|
|
* [Known issues](#known-issues)
|
2022-12-03 23:24:07 +01:00
|
|
|
* [Todo](#todo)
|
2022-11-25 22:19:00 +01:00
|
|
|
* [FAQ](#faq)
|
|
|
|
* [How do I find my account ID?](#how-do-i-find-my-account-id)
|
|
|
|
* [Can I modify the plugin?](#can-i-modify-the-plugin)
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Place the following shortcode right into the page. Either as shortcode block or just copy and paste right within a text block:
|
|
|
|
|
2022-11-29 22:21:29 +01:00
|
|
|
```[include-mastodon-feed instance="YOUR-INSTANCE" account="YOUR-ACCOUNT-ID"]```
|
2022-11-25 22:19:00 +01:00
|
|
|
|
|
|
|
### Supported shortcode attributes
|
|
|
|
|
2024-11-23 22:40:25 +01:00
|
|
|
| Attribute | Default value | Example | Description |
|
2022-12-09 14:55:36 +01:00
|
|
|
| ------------------- | ----------------------------- | ------------------------- | ----------------------------------------------------------------- |
|
2024-11-23 22:40:25 +01:00
|
|
|
| **instance** | | instance="example.org" | (required attribute) Domain name of the instance without https:// |
|
2022-12-09 15:36:17 +01:00
|
|
|
| **account** | | id="012345678910" | (required attribute) Your account ID ([a long number](#how-do-i-find-my-account-id)) |
|
2024-06-20 16:56:27 +02:00
|
|
|
| tag | | tag="travel" | 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 | 20 | limit="10" | Maximum number of statuses |
|
|
|
|
| excludeBoosts | false | excludeBoosts="true" | Exclude boosted statuses |
|
2023-06-23 20:22:24 +02:00
|
|
|
| excludeReplies | false | excludeReplies="true" | Exclude replies to other accounts |
|
2023-06-23 20:29:28 +02:00
|
|
|
| excludeConversationStarters | false | excludeConversationStarters="true" | Exclude statuses that start with a user mention |
|
2022-12-09 14:55:36 +01:00
|
|
|
| onlyPinned | false | onlyPinned="true" | Show only pinned statuses |
|
|
|
|
| onlyMedia | false | onlyMedia="true" | Show only statuses containing media |
|
2024-06-20 16:56:27 +02:00
|
|
|
| preserveImageAspectRatio | false | preserveImageAspectRatio="true" | Preserve image aspect ratio |
|
2024-11-16 01:03:41 +01:00
|
|
|
| imageSize | "preview" | imageSize="full" | Load small sized preview images or full size high quality images |
|
2024-11-16 02:10:14 +01:00
|
|
|
| imageLink | "status" | imageLink="image" | Link image to status or image |
|
2022-12-09 14:55:36 +01:00
|
|
|
| tagged | false | tagged="tagname" | Show only statuses that are tagged with given tag name (no #!) |
|
2022-12-09 15:18:39 +01:00
|
|
|
| linkTarget | "_self" | linkTarget="_blank" | Target for all links |
|
2023-05-02 15:23:24 +02:00
|
|
|
| showPreviewCards | true | showPreviewCards="false" | Show preview cards |
|
2024-06-20 16:56:27 +02:00
|
|
|
| hideStatusMeta | false | hideStatusMeta="true" | Hide status meta information (automatically also hides date and time) |
|
|
|
|
| hideDateTime | false | hideDateTime="true" | Hide date and time from status meta information |
|
2022-12-09 15:36:17 +01:00
|
|
|
| darkmode | false | darkmode="true" | Enable dark mode |
|
|
|
|
| text-loading | "Loading Mastodon feed..." | text-loading="Loading ⏳" | Loading text |
|
2023-06-23 21:36:00 +02:00
|
|
|
| text-noStatuses | "No statuses available" | text-noStatuses="💩" | Text if no statuses are available |
|
2022-12-09 15:36:17 +01:00
|
|
|
| text-boosted | "boosted 🚀" | text-boosted="🚀" | Boosted status indicator text |
|
|
|
|
| text-viewOnInstance | "view on instance" | text-viewOnInstance="🔗" | View status on instance link text |
|
|
|
|
| text-showContent | "Show content" | text-showContent="👀" | Text for content warning buttons |
|
2023-04-09 14:02:31 +02:00
|
|
|
| text-permalinkPre | "on" | text-showContent="📅" | Text before post permalink (date & time) |
|
|
|
|
| text-permalinkPost | "" | text-showContent="📅" | Text after post permalink (date & time) |
|
|
|
|
| text-edited | "(edited)" | text-showContent="✏" | Text indicating edited posts |
|
2022-12-09 15:36:17 +01:00
|
|
|
| date-locale | "en-US" | date-locale="de-DE" | Locale for date string, used in toLocaleString() |
|
2023-06-23 20:22:24 +02:00
|
|
|
| date-options | "{}" | date-options="{dateStyle: 'short', timeStyle: 'long'}" | Format options directly fed into toLocaleString() |
|
2022-11-25 22:19:00 +01:00
|
|
|
|
|
|
|
### Additional customizations
|
|
|
|
|
2022-12-08 00:28:27 +01:00
|
|
|
You can define several plugin constants to set custom default options that will be applied site-wide.
|
2022-11-25 22:19:00 +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 this line and `/* That's all, stop editing! Happy publishing. */`
|
|
|
|
|
|
|
|
See [config-example.php](config-example.php) for a full list of supported settings.
|
2022-11-25 22:19:00 +01:00
|
|
|
|
2022-11-25 22:51:44 +01:00
|
|
|
## Installation
|
|
|
|
|
2023-04-09 14:35:05 +02:00
|
|
|
The plugin is available through the official Wordpress plugin directory https://wordpress.org/plugins/include-mastodon-feed/
|
|
|
|
|
|
|
|
1. Log into your Wordpress installation
|
|
|
|
2. Go to "Plugins" and select "Add New"
|
|
|
|
3. Search for "Include Mastodon Feed"
|
|
|
|
4. Hit the "Install" button
|
|
|
|
5. After installation hit the "Activate" button
|
2022-11-25 22:51:44 +01:00
|
|
|
|
|
|
|
### Installation via ZIP file
|
|
|
|
|
|
|
|
1. Click on the `<>Code` in the top right of this page
|
|
|
|
2. Select `Download ZIP`
|
2022-11-29 22:17:34 +01:00
|
|
|
3. Create a `include-mastodon-feed` folder in your Wordpress plugins directory
|
2022-11-25 22:51:44 +01:00
|
|
|
4. Unpack all the files from the ZIP there (files only, no sub-directory)
|
|
|
|
5. Enable plugin in Wordpress
|
|
|
|
6. Use shortcode
|
|
|
|
|
|
|
|
### Installation via git checkout
|
|
|
|
|
|
|
|
If you are familiar with Github you can clone the repository right into your Wordpress plugins folder
|
|
|
|
|
|
|
|
1. SSH into your webserver
|
|
|
|
2. `cd /path/to/wordpress/wp-content/plugins`
|
2022-11-29 22:17:34 +01:00
|
|
|
3. `git clone https://github.com/wolfgang101/include-mastodon-feed.git`
|
2022-11-25 22:51:44 +01:00
|
|
|
4. Enable plugin in Wordpress
|
|
|
|
5. Use shortcode
|
|
|
|
|
2022-11-25 23:52:15 +01:00
|
|
|
## Known issues
|
|
|
|
|
2022-12-03 23:24:07 +01:00
|
|
|
### Todo
|
2022-11-25 23:52:15 +01:00
|
|
|
|
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-25 23:52:15 +01:00
|
|
|
|
2022-11-25 22:19:00 +01:00
|
|
|
## FAQ
|
|
|
|
|
|
|
|
### How do I find my account ID?
|
2024-11-23 22:40:25 +01:00
|
|
|
Please feel free to use [this handy lookup tool](https://wolfgang.lol/code/include-mastodon-feed-wordpress-plugin/)
|
|
|
|
|
2022-11-25 22:19:00 +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
|
|
|
|
|
|
|
|
Use the following URL to get your ID:
|
|
|
|
|
2022-11-29 22:17:34 +01:00
|
|
|
```https://example.org/api/v2/search?q=username@example.org&resolve=true&limit=5```
|
2022-11-25 22:19:00 +01:00
|
|
|
|
2022-11-29 22:17:34 +01:00
|
|
|
* Change `example.org` to your instance
|
2022-11-25 22:19:00 +01:00
|
|
|
* Replace `username` with your handle.
|
|
|
|
* Open the URL in your webbrowser
|
|
|
|
|
|
|
|
**Note:** You must be logged in to do that
|
|
|
|
|
|
|
|
### Can I modify the plugin?
|
2022-11-29 22:17:34 +01:00
|
|
|
The plugin is released unter the [Expat License](LICENSE) which is very permissive. Knock youself out!
|