[WordPress] 外掛分享: Hum

首頁外掛目錄 › Hum
500+
安裝啟用
★★★★★
5/5 分(8 則評價)
25 天前
最後更新
問題解決
WordPress 3.0+ PHP 7.4+ v1.3.6 上架:2011-01-26

內容簡介

Hum 是一款專為 WordPress 設計的個人網址縮短器,能為您的個人內容提供簡短的網址,無論是託管於 WordPress 還是其他平台。使用 Hum,您可以輕鬆地將冗長的網址轉換為簡潔的短網址,提升分享的便利性。

【主要功能】
• 提供個人化的網址縮短功能
• 支援自訂短網址域名
• 使用 NewBase60 編碼優化網址可讀性
• 內建錯誤修正功能,避免混淆字符
• 可擴展本地類型以支援更多前綴
• 簡單的重定向設定功能

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3.6) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Hum」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Hum is a personal URL shortener for WordPress, designed to provide short URLs to your personal content, both hosted on WordPress and elsewhere. For example, rather than a long URL for a WordPress post such as http://willnorris.com/2011/01/hum-personal-url-shortener-wordpress, you could have a short URL like http://willnorris.com/b/FJ. Additionally, if you have a custom domain for short URLs, you can shorten things further like http://wjn.me/b/FJ. Once the plugin is enabled, the shortlink for a page or post can be found in the “Shortlink” item in the WordPress Admin Bar.
WordPress post IDs are shortened using the NewBase60 encoding scheme which is specifically optimized for brevity and readability, with built-in error correction for commonly confused characters like ‘1’, ‘l’, and ‘I’.
Hum is not designed as a general purpose URL shortener along the lines of http://bit.ly or http://goo.gl. Rather, it is specifically intended as a personal shortener for your own content.
Read more about the reasoning for a personal URL shortener at Tantek Celik‘s page for Whistle, which served as the inspiration for Hum.
Developer Documentation
Adding your Amazon Affiliate ID
If you’d like to include your Amazone Affiliate ID in the /i/ redirect URLs, implement the amazon_affiliate_id filter. For example:
add_filter('amazon_affiliate_id', fn() => "willnorris-20");

Additional Local Types
Out of the box, Hum only registers the b, t, a and p prefix to be served locally by WordPress. If you would like to register additional prefixes, implement the hum_local_types filter. For example, to include ‘p’ as well for photos:
function myplugin_hum_local_types( $types ) {
$types[] = 'p';
return $types;
}
add_filter('hum_local_types', 'myplugin_hum_local_types');

This will tell Hum to serve any /p/{id} URLs from WordPress. Additionally, you’ll want to instruct Hum to use your prefix for that particular content type. Here, we’re registering ‘p’ which is normally used for photos.
function myplugin_hum_type_prefix( $prefix, $post_id ) {
$post = get_post( $post_id );

if ( $post->post_type ## 'attachment' &&
strpos($post->post_mime_type, 'image') =## 0 ) {
$prefix = 'p';
}

return $prefix;
}
add_filter('hum_type_prefix', 'myplugin_hum_type_prefix', 10, 2);

Simple Redirect
You can redirect all traffic for a prefix using a single line of PHP my implementing the hum_redirect_base_{type} filter where {type} is the prefix to redirect. For example, I redirect all /w/ URLs to wiki.willnorris.com using:
add_filter('hum_redirect_base_w', fn() => "http://wiki.willnorris.com/");

延伸相關外掛

文章
Filter
Mastodon