[WordPress] 外掛分享: GET Params

前言介紹

  • 這款 WordPress 外掛「GET Params」是 2014-01-04 上架。
  • 目前有 1000 個安裝啟用數。
  • 上一次更新是 2019-07-18,距離現在已有 2117 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.0 以上版本才可以安裝。
  • 有 15 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

levertechadmin |

外掛標籤

GET | vars | params | shortcode |

內容簡介

GET params 是一個外掛,它可以為您的頁面和文章提供簡碼,讓您可以在頁面和文章中顯示來自當前 URL 的 GET 參數,或根據 GET 參數值顯示/隱藏內容。

例如,作者使用此外掛可讓使用者透過在 WordPress 網站上指定的 URL 和 GET 變數來顯示個人化的安裝指示,以便他們可以按照所需的自訂欄位和區段安裝軟體。

如果您在 WordPress 4.2.3 以上版本中遇到問題,請參閱 FAQ。

以下是範例,假設使用者轉到您的文章頁面 http://example.com/post/3/?paramname=showme:

直接顯示 GET 參數
[display-get-param name="paramname"]

顯示名為 paramname 的 GET 參數的值(例如範例 URL 中的 ‘showme’),如果未給定則顯示 “空值”。

[display-get-param name="paramname" default="Paramname was blank"]

顯示名為 paramname 的 GET 參數的值,或如果未給定則顯示 “Paramname was blank”。

根據 GET 參數值控制包含內容的顯示
[display-if-get name="myparam"]

只有當 myparam 作為 GET 參數傳遞時(具有任何值)才會顯示此封閉內容

[/display-if-get]

另一個範例指定了要匹配的值:

[display-if-get name="myparam" value="true"]

只有當 myparam 作為 GET 參數傳遞且等於 "true" 時才顯示此內容

[/display-if-get]

倒轉條件

此外掛還包含一個與 display-if-get 相反的函式,名為 display-if-not-get。

只有在 display-if-get 使用相同參數時不顯示內容的所有情況下,display-if-not-get 內容才會顯示。

這意味著,如果 URL 查詢字符串中根本不存在命名的參數,display-if-not-get 內容也將會顯示。

If/else 區塊

這基本上可以通過使用具有相同參數的 display-if-get 和 display-if-not-get 的組合來實現。

[display-if-get name="opt" value="1"]

您選擇了選項 1 - URL 包含 /?opt=1。

[/display-if-get]

[display-if-not-get name="opt" value="1"]

您選擇了不是選項 1 的其他選項。

[/display-if-not-get]

原文外掛簡介

GET params is a plugin providing your pages and posts with shortcodes allowing you to display GET parameters from
the current URL in pages and posts, or show/hide content depending on GET param values.
As an example, I use this plugin so that I can show personalized installation instructions to users of another piece of
software I wrote, simply by directing them to a URL on my WordPress site, along with GET variables chosen to
ensure that custom fields and sections display exactly as required for them to install my software.
See FAQ if you are having problems under WordPress 4.2.3
Examples follow, assuming the user goes to your post page http://example.com/post/3/?paramname=showme
Displaying GET parameters directly
[display-get-param name="paramname"]

Shows the value of GET named paramname (‘showme’ in the example URL), or “blank value” if none given.
[display-get-param name="paramname" default="Paramname was blank"]

Shows the value of GET named paramname, or “Paramname was blank” if none
Controlling display of enclosed content depending on GET parameter values
[display-if-get name="myparam"]

This enclosed content only shows if myparam is passed as a GET param (with any value)

[/display-if-get]

Another example specifying a value to match:
[display-if-get name="myparam" value="true"]

This content only shows if myparam is passed as a GET param and equals "true"

[/display-if-get]

Inverting the criteria
The plugin also contains an opposite to display-if-get, called display-if-not-get.
display-if-not-get content will display only in all cases where display-if-get with the same parameters would NOT show.
This means that display-if-not-get content will also show if the named parameter does not exist at all in the URL query string.
If/else blocks
This is essentially possible by using a combination of display-if-get and display-if-not-get with the same parameters.
[display-if-get name="opt" value="1"]

You chose option 1 - URL contains /?opt=1.

[/display-if-get]

[display-if-not-get name="opt" value="1"]

You chose an option that is not option 1.

[/display-if-not-get]

各版本下載點

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

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


1.0 | 1.1 | trunk |

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

  • WP Shortcodes Plugin — Shortcodes Ultimate 》Shortcodes Ultimate 是一個全面的視覺與功能性元素收集,您可以在文章編輯器、文字小工具甚至是範本檔案中使用。使用 Shortcodes Ultimate,您可以輕鬆地建...。
  • MW WP Form 》MW WP Form 可以使用 shortcode 創建帶有確認畫面的郵件表單。, , 使用 shortcode 創建表單, 可以使用確認頁面。, 頁面可以使用相同的 URL 或個別的 URL 進行...。
  • Shortcoder — Create Shortcodes for Anything 》Shortcoder 外掛可讓您建立 HTML、JavaScript、CSS 和其他代碼片段的自訂捷徑。現在,這些捷徑可以在文章/頁面中使用,並且該片段將取代其位置。, ✍ 輕鬆建立...。
  • Display Posts – Easy lists, grids, navigation, and more 》Display Posts 讓您輕鬆地列出網站上的所有內容。首先在內容編輯器中新增此短碼,以列出最近的文章清單:, [display-posts], , 按類別篩選, 若只想顯示特定類...。
  • Widget Shortcode 》這個短碼需要小工具的ID,但不需要猜測,外掛會為你生成代碼。如果你想要覆蓋小工具的標題,你可以使用 "title" 參數:, [widget id=”text-1″...。
  • Woody code snippets – Insert Header Footer Code, AdSense Ads 》需要專業的支援嗎?, 免費獲取支援, 開始獲得高級支援, , 停止反覆使用相同的內容!, 停止插入 function.php 中的 PHP 代碼!, 停止將 Google Analytics、Yan...。
  • Column Shortcodes 》此外掛提供簡單易用的短碼,在您的文章或頁面中輕鬆創建欄位。有時候,您只需要將網頁切成不同的欄位。使用此外掛,您只需選擇一個欄位的短碼,便可將欄位加...。
  • amr shortcode any widget 》使用shortcode將小工具或多個小工具或整個小工具區域(側邊欄)插入到頁面中。, 首先在正常的側邊欄中設置小工具。 檢查它是否正常運作。, 然後將所選小工具...。
  • Shortcode in Menus 》此外掛讓你可以在 WordPress 導覽選單中使用簡碼,以便可以動態生成連結。也可以讓你在導覽選單中添加完整的 HTML 段落。, 使用方法, 查看截圖。, 另外,查看...。
  • Sidebar Widgets by CodeLights 》❗ 很抱歉,由於 SiteOrigin 的 widgets API 完全更改,CodeLights 不再支援 SiteOrigin Page Builder 的原生使用。解決方案:您仍然可以在純文字編輯器中創...。
  • Advanced iFrame 》看起來您正在尋找一個 WordPress 外掛 - Advanced iFrame Pro。這個外掛可讓您使用 iframe 包含其他網頁到您的網站中,同時具有隱藏和修改元素、自動調整高度...。
  • Insert Pages 》Insert Pages 可讓您使用 Shortcode API,將任何 WordPress 內容(例如,頁面、文章、自訂文章類型)嵌入其他 WordPress 內容。它還包括一個小工具,可將頁面...。
  • Shortcodes by Angie Makes 》Shortcodes by Angie Makes 外掛為您的 WordPress 主題新增一系列易於使用的短碼,這些短碼與 Angie Makes WordPress 主題 完美搭配。, 範例, 請到此查看這些...。
  • Team Members 》這個外掛會為管理員面板增加一個「團隊」區塊,讓您可以輕鬆地在網站上展示您的員工/職員。您可以快速地將成員加入您的團隊,加入他們的照片、職位、個人簡介...。
  • Post Snippets – Custom WordPress Code Snippets Customizer 》, 建立自訂短碼和可重複使用的內容,並將它們插入到您的文章和頁面中。, , 此外掛讓您建立 HTML、PHP 程式碼或常用文字片段的庫。在文章和頁面中,您可以使用...。

文章
Filter
Apply Filters
Mastodon