开发者 |
pfefferle
dshanske indieweb |
---|---|
更新时间 | 2024年9月14日 14:54 |
捐献地址: | 去捐款 |
PHP版本: | 7.0 及以上 |
WordPress版本: | 6.6 |
版权: | MIT |
版权网址: | 版权信息 |
webmention
" into the Search Plugins box.wp-content/plugins
folder in your WordPress directory online.Webmention is a simple way to automatically notify any URL when you link to it on your site. From the receivers perpective, it's a way to request notification when other sites link to it.
Webmention is an update/replacement for Pingback or Trackback. Unlike the older protocols, the specification is recommended by the W3C as well as an active community of individuals using it on their sites.
On the Settings --> Discussion Page in WordPress:
send_webmention($source, $target)
function and pass a source and a target or you can fire an action like do_action('send_webmention', $source, $target)
.
When declaring your custom post type, add post type support for Webmentions by either including it in your register_post_type
entry. This can also be added in the Webmention settings.
You can enable receiving Webmentions for attachments in Webmention settings. You can enable sending Webmentions for media links in the settings. Please note that most receivers of Webmentions do not support receiving them to image, audio, and video files. In order to support receiving them on WordPress, Webmention endpoint headers would have to be added at the webserver level.
Webmentions should be allowed on all URLs of a blog, however WordPress does not support this as only posts can have comments attached to them. The plugin currently handles only Webmentions on posts and allows you to set a page to receive homepage mentions. Even though it is not done automatically, it is very simple to add support for archives and URLs on your site by providing a post/page to show collect mentions. The plugin provides a simple filter for that. In the below example, if there is no page returned it will send mentions to a catch-all post. You can also have unique posts per URL. function handle_other_webmentions($id, $target) { // do nothing if id is set if ($id) { return $id; } // return "default" id if plugin can't find a post/page return 9247; } add_filter("webmention_post_id", "handle_other_webmentions", 10, 2);
The URL for the Webmention endpoint, which you can view in the source of your pages, should be excluded from any server or plugin caching. As Webmention uses the REST API endpoint system, most up to date caching plugins should exclude it by default.
Webmentions have the ability to act as rich comments. This includes showing avatars. If there is an avatar discovered, the URL for it will be stored. This can either be reflect something from the media library or a URL of a file. If the file is broken, it will store a local copy of the default gravatar image.
Webmention headers are only shown if Webmentions are available for that particular URL. If you want to show it regardless, you can add below to your wp-config.php file. define( 'WEBMENTION_ALWAYS_SHOW_HEADERS', 1 );
This plugin includes several enhancements to the built-in WordPress commenting system to allow for enhancement, while allowing existing methods to offer customization. It customizes the classic defaults for WordPress to account for webmentions by using a custom comment walker that minimally changes to defaults.
By default, many themes provide a custom callback to the wp_list_comments
function. This plugin adds several enhancements to that. For one, the custom callbacks argument is usually a string with the function name. We enhance it to behave as normal in that case, but if an array is passed, to allow specific callbacks per the key of the array, or the 'all' key as a default. This means each comment type, which would be each webmention type or otherwise, can have its own custom callback.
It introduces a new version of the default function for html5 comments, adding correct microformats2 markup, and for webmentions, a proper site citation, e.g. Bob @ Example.Com as well as a hook, webmention_comment_metadata
which offers a comment object as the sole argument, to add arbitrary metadata. This would be overridden by any custom comment rendering done by themes.
There is an option within the plugin to show webmentions not determined to be replies or comments inline, or to display them separately as avatar only lists. The wp_list_comments
function is overridden to allow for the avatar_only
option, which will render this, with a second option of overlay
to overlay an icon reflecting the reaction type. Reactions are webmention types such as like, which there is no textual component to it. If you opt to display them as comments, the text will read that the author likes this post
.
While not all display options can be settings, we are looking to provide some simple options which could be customized in a theme if needed.
version()
methodcomment_link
only for Webmentions and only in the frontendcomment_link
only for Webmentions that have a sourcecomments.php
onerror
handling also for srcset
( props @florianbrinkmann for testing )onerror
handling for broken images ( props @snarfed )Webmention_Notification
class until proper tested/usedwp_allow_comment
function called by the wp_new_comment
function.pings_open
is_avatar_comment_type
(introduced 5.1) and get_self_link
(introduced 5.3) for use in this pluginwebmention_avatars
on the settings pagewebmention_avatars
wp_add_privacy_policy_content
callwebmention-for-comments
pluginedit_webmention
hook due comment array filteringcomment_author_url
if not set.webmention_target_url
and webmention_target_fragment
webmention_post_id
filter to a global function (thanks @dshanske)webmention_post_send
(props to @snarfed)webmention_comment_parent
filtertitle
and content
discoverywebmention_links
filterpublish_post_hook
functiontitle
and content
discoverywebmention_links
filterpublish_post_hook
function