Include Mastodon Feed

Beschrijving

Plugin die een [include-mastodon-feed] shortcode biedt om mastodon feeds eenvoudig te integreren in WordPress pagina’s.

De plugin is geschreven in PHP en genereert native JavaScript om de mastodon feed op te halen en weer te geven. Geen speciale bibliotheken nodig.

Installatie

  1. Upload de “include-mastodon-feed” map naar de folder “/wp-content/plugins/”.
  2. Activeer de plugin via het ‘Plugins’ menu in WordPress.
  3. Voeg de shortcode toe aan elke pagina.

Shortcode voorbeeld

[include-mastodon-feed instance="YOUR-INSTANCE" account="YOUR-ACCOUNT-ID"]

Shortcode attributen

  • account (vereist)
    Het account ID (een lang nummer – zie FAQ voor hoe je het kunt krijgen)

  • instance (required)
    Domain name of the instance without https:// (e.g. example.org)

  • limit
    Maximum number of statuses (Default: 20)

  • excludeReplies
    Exclude replies to other accounts (Default: false)

  • excludeConversationStarters
    Exclude statuses that start with a user mention (Default: false)

  • excludeBoosts
    Exclude boosted statuses (Default: false)

  • onlyPinned
    Show only pinned statuses (Default: false)

  • onlyMedia
    Show only statuses containing media (Default: false)

  • tagged
    Show only statuses that are tagged with given tag name (Default: false)
    No leading #, case insensitive, e.g.: tagged=”tagname”

  • linkTarget
    Target for all links e.g. new tab would be “_blank” (Default: _self)

  • showPreviewCards
    Show preview cards (Default: true)

  • darkmode
    Enable dark mode (Default: false)

  • text-loading
    Loading text (Default: Loading Mastodon feed…)

  • text-noStatuses
    Text if no statuses are available (Default: No statuses available)

  • text-boosted
    Text indicating boosted statuses (Default: boosted 🚀)

  • text-viewOnInstance
    View status on instance link text (Default: view on instance)

  • text-showContent
    Text for content warning buttons (Default: Show content)

  • 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))

  • date-locale
    Locale for date string, used in toLocaleString() (Default: en-US)

  • date-options
    Format options directly fed into toLocaleString() (Default: {})

Extra aanpassingen

You can define several plugin constants to set custom default options that will be applied site-wide.

  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.

FAQ

Hoe vind ik mijn account ID?

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:
* You might have to be logged in to get any results
* Change example.org to your instance
* Replace username with your handle.

Use the following URL to get your ID:

https://example.org/api/v2/search?q=username@example.org&resolve=true&limit=5

Known Issues / Todo

  • improve support for video and audio media attachment types
  • integrate i18n into translate.wordpress.org instead of text constants
  • re-build plugin as custom gutenberg block

Beoordelingen

11 november 2023
thanks a lot! Works charming ...
26 juli 2023
Simple installation, perfect description, user ID in seconds, minimal customization. This plugin just does what it should do.
12 juli 2023
The instructions look a bit intimidating to start with, but it's actually pretty simple to install and configure. The FAQ tells you how to find your account number, and there are plenty of shortcode options to customise the feed.
16 juni 2023 8 reacties
Overall this is fantastic and offers some easy to use customizations with shortcode. Well done, thank you!!The only thing I'd like to see in the future is the ability to exclude @'s to other users. You can already disable replies which is great, but I'd like to suppress conversations I start with other users.
Lees alle 12 beoordelingen

Bijdragers & ontwikkelaars

“Include Mastodon Feed” is open source software. De volgende personen hebben bijgedragen aan deze plugin.

Bijdragers

“Include Mastodon Feed” is vertaald in 2 talen. Dank voor de vertalers voor hun bijdragen.

Vertaal “Include Mastodon Feed” naar jouw taal.

Interesse in ontwikkeling?

Bekijk de code, haal de SVN repository op, of abonneer je op het ontwikkellog via RSS.

Changelog

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

1.9.2

  • fix: style for embedded videos / GIFs
  • refactor: play gifv on mouseover
  • refactor: load markup related javascript in footer instead of embedding it directly with the html markup

1.9.1

  • refactor: show meaningful message if no statuses are available
  • fix: broken excludeConversationStarters logic

1.9.0

  • added option to exclude conversation starters (posts that start with a user mention)

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

1.8.0

  • added option to show/hide preview cards
  • refactoring: introducing plugin namespace
  • refactoring: improved debug console output

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

1.6.0

  • image attachments are now clickable (link to original status)

1.5.0

  • added option to show only statuses with specific tag
  • added option to set link target to make links open in new tab
  • added option to set maximum number of statuses

1.4.2

  • fixed styling issue with emojis in account display name

1.4.1

  • fixed styling issue with boosted account links

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

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

1.3.0

  • added new feed options: excludeReplies, onlyPinned, onlyMedia

1.2.0

  • fixed broken JavaScript if post included media attachments other than images
  • fixed custom “view on instance” option
  • added option for custom content warning button text
  • added option to exclude boosted statuses
  • added support for gifv media attachments

1.1.0

  • added support for more custom text overrides (loading, boosted, view on instnace)
  • switched to showing static avatars, animated avatars only on hover

1.0.1

  • escaped options when echoing them
  • secured local file inclusion
  • changed versioning to semantic versioning – now including patch number

1.0

  • Initiële release