[WordPress] 外掛分享: Simple Permalink

前言介紹

  • 這款 WordPress 外掛「Simple Permalink」是 2012-05-28 上架。
  • 目前有 40 個安裝啟用數。
  • 上一次更新是 2013-04-19,距離現在已有 4398 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.0 以上版本才可以安裝。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

themeblvd |

外掛標籤

url | permalink | themeblvd |

內容簡介

這個外掛會根據 ID 使用 [permalink] 短碼來檢索頁面或文章的永久連結網址。

這個外掛的目的是什麼?

在使用 WordPress 建立自己的網站時,我開始注意到我喜歡在文章中連結到其他文章。但我總是改變我的想法,更改頁面或文章別名,並改變我的永久連結。當我必須回去更改我放置連結的位置時,這很煩人。

這個外掛相當簡單。它只是根據 WordPress 獨特的數值 ID 檢索頁面或文章的網址,而這個 ID 永遠不會變。對我個人而言,每次在我的網站內連結到另一個頁面或文章時使用 [permalink] 短碼會讓我的生活變得更輕鬆,因為我不用擔心網址會變化。此外,當我將我的網站從本地開發服務器移動到網際網路伺服器時,我不用擔心任何這些連結。

無論如何,我想,“為什麼不分享呢?”-- 我總是將這個代碼片段粘貼到所有個人網站主題中。

但是,請記住,此外掛對於像我一樣總是在編輯頁面和文章時在HTML選項卡下工作的人來說會更加有用。如果您正在尋找一個類似的短碼,可以為您構造整個HTML連結,請查找由 Justin Tadlock 創建的此外掛程式。

使用範例

由於此外掛只是檢索文章或頁面的網址,因此您需要以您通常的方式格式化標準的HTML連結。然後,取代手動寫入文章或頁面的網址,使用 [permalink] 短碼來檢索它。在裡面,您引用 WordPress 的數值 ID 來取得文章或頁面的網址。

Your Text

Your Text

Your Text

擴展使用範例

在 v1.0.1 中,我新增了可選功能,允許您使用頁面別名來引用您正在嘗試檢索永久連結。

Your Text

如果您引用的不是頁面,您需要使用可選的“post_type”參數來指定文章類型。

Your Text

如果您能使用文章 ID,那麼以這種方式檢索永久連結將消耗較少的伺服器資源。

那麼為什麼要使用別名?為什麼不總是使用 ID?個人而言,我添加了這個功能給自己。當我為我的 WordPress 主題建立示範網站時,我總是導入很多彼此之間的相同頁面,這些頁面互相內部鏈接。如您所知,在不同網站之間導入頁面和文章時,ID 通常會變化。通過使用此短碼並引用頁面/文章別名,當我將頁面導入/導出到不同的網站時,我可以保持 URL 不變。

原文外掛簡介

This plugin retrieves the permalink URL for a page or post based on the ID with the shortcode [permalink].
What’s the point of this plugin?
In creating my own sites with WordPress, I started noticing that I like to link to articles within other articles. Then I’m always changing my mind about stuff, messing around with page/post slugs, and screwing with my permalinks. It’s very annoying to then have to go back and change links wherever I placed them.
This plugin is pretty simple. It just retrieves the URL of a page or post based on WordPress’s unique, numerical ID for it, which never changes. For me personally, using the [permalink] shortcode every time I link to another page or post within my site makes life easier because I don’t have to worry about the URL changing. Also, when I move my site from my local dev server to the live web server, I don’t have to worry about any of these links.
Anyways, I thought what the heck, why not share? — I keep pasting this code snippet in all my personal website themes anyway.
However, keep in mind this plugin will be more useful for people like me who are always working under the HTML tab when editing pages and posts. If you’re looking for a similar shortcode that constructs the entire HTML link for you, check out this plugin by Justin Tadlock.
Usage Examples
Since all this plugin does is retrieve the URL to the post or page, you need to format a standard HTML link in whatever way you normally would. Then, instead manually writing in the post or page’s URL, you retrieve it with the [permalink] shortcode. Inside, you reference the WordPress’s numeric ID for the post or page.
Your Text

Your Text

Your Text

Extended Usage Examples
In v1.0.1, I added the optional feature to allow you to use a page’s slug to reference the permalink you’re trying to retrieve.
Your Text

If you’re referencing anything other than a page, you need to specify the post type with the optional “post_type” parameter.
Your Text

If you can use the Post ID, it will consume less resources on your server to retrieve the permalinks that way.
So why use the slug at all? Why not just always use the ID? Well personally, I added this in for myself. When I setup demo websites for my WordPress themes, I’m always importing many of the same pages that innerlink with eachother. As you know, when importing pages and posts between different websites, ID’s will generally change. By using this shortcode and referencing page/post slugs, I can keep URL’s intact when I’m importing/exporting pages to different websites.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Simple Permalink」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0.0 | 1.0.1 | trunk |

延伸相關外掛(你可能也想知道)

  • Custom Post Type Permalinks 》自訂文章類型永久連結允許您編輯自訂文章類型的永久連結結構。, 更改自訂分類目錄的永久鏈接,以“example.org/post_type/taxonomy_name/term_slug̶...。
  • Custom Permalinks 》name or slug), add the filter that looks like this:, function yasglobal_exclude_posts( $post ) {, // Replace '2' with ID of the post you want to ...。
  • Featured Image from URL (FIFU) 》h3>WordPress 外掛 - 用於顯示外部特色圖片、影片、音訊等等, FIFU 自 2015 年來已幫助全球數千個網站節省了儲存空間、處理時間和版權費用。, 如果您已經厭倦...。
  • Shortcode Redirect 》這款「Shortcode Redirect」外掛讓網站擁有者在網站的頁面或文章上查看特定的秒數之後,自動將使用者重新導向到其他網站。外掛的使用方式非常簡單,只需在貼...。
  • URL Params 》URL Params WordPress 插件允許您訪問 URL 中查詢字符串中的 URL 參數。, 這個插件甚至允許您在短代碼中指定一個默認值,如果該參數沒有設置,那麼如果您想說...。
  • Simple Page Redirect 》這個外掛可以將任何文章/頁面/自訂文章型別/作品集重新導向到任何內部或外部網址。它為所有預設和自訂文章型別的單頁添加了文字選項。, 啟用外掛後,在文章編...。
  • Move Login 》這個外掛可以禁止訪問 https://example.com/wp-login.php,並建立新的 URL,例如 https://example.com/login 或 https://example.com/logout。, 這是防止機器...。
  • Root Relative URLs 》這是一個 WordPress 外掛,可將所有 URL 格式轉換為 root-relative URLs,以實現在暫存 / 生產主機環境之間以及在移動設備上進行調試 / 測試時的無縫切換,而...。
  • Permalink Manager for WooCommerce 》Permalink Manager for WooCommerce旨在提供更美觀的網址,使其更易於閱讀。, 主要優勢, , 使用301狀態重定向重複的頁面, 可獨立配置產品、分類和標籤, 選擇...。
  • Featured Image by URL 》Featured Image by URL :, Featured Image by URL 允許使用來自外部 URL 的圖片作為您文章、頁面和類似 WooCommerce 產品等自訂文章類型的特色圖片。包括支...。
  • WP Force Lowercase URLs 》對於所有非管理員的 URL(不包括文件名),將大寫 URL 重定向至小寫版本。, 如有任何錯誤或功能請求,請在以下鏈接回報。, 錯誤:, , 回報位址:Github 問題...。
  • Bitly's WordPress Plugin 》喜歡使用 WordPress 嗎?還喜歡 Bitly 嗎?安裝這個外掛後,您將能夠縮短連結並從 WordPress 中查看點擊率。您的新連結將保存到 Bitly 中以供參考和深入分析...。
  • Simple Mobile URL Redirect 》這是一個簡單的行動裝置重導向外掛程式,適用於使用不同網址來呈現行動裝置內容的使用者。只需要輸入完整路徑的網址,即可讓使用者前往行動裝置專屬的內容。。
  • WP Author Slug 》這個外掛會以使用者顯示名稱的已消毒版本來替換作者標誌。, 這個外掛無法防止駭客找到你的登錄名稱,但登錄名稱不會顯示在作者檔案的 URL 中,並且可以使用顯...。
  • Smart User Slug Hider 》Smart User Slug Hider 外掛可隱藏作者頁面的使用者名稱,以增強安全性。, 使用方式, 本外掛自動將使用者名稱替代為 16 位元數字代碼字串,不需要任何設定。...。

文章
Filter
Apply Filters
Mastodon