[WordPress] 外掛分享: GET Custom Content

首頁外掛目錄 › GET Custom Content
10+
安裝啟用
尚無評分
4085 天前
最後更新
問題解決
WordPress 3.0+ v1.1.1 上架:2013-11-18

內容簡介

E 這個外掛讓你可以建立自訂內容,根據 URL 中的查詢變數顯示在 WordPress 文章中。例如,在你的 URL 中加上「?customer=yes」,會讓側邊欄顯示「我們愛我們的顧客!」,而「?customer=notyet」則會讓側邊欄顯示「今天成為我們的客戶!」。

此外,外掛包括一個短碼以將自訂內容插入到頁面或文章中,還有一個小工具可以將自訂內容添加到側邊欄中。

使用方法:

安裝外掛後,在儀表板菜單中會出現「GET Custom Content」。

以下是幾個步驟:

1. 建立變數。在儀表板菜單的「GET Custom Content」下面點擊「Custom Content Variables」,然後輸入你的變數名稱,然後點擊「新增變數」。

2. 建立變數值。在儀表板菜單的「GET Custom Content」下點擊「新增值」,輸入變數值的名稱和內容,然後在編輯畫面的「GET Custom Content Variables」框中選擇它所屬的變數。

如果你想將這個特定的值作為預設值,在編輯畫面上勾選「Make this the Default?」的核取方塊。如果變數未在 URL 中定義(如www.example.com)或定義了變數但值不存在(如www.example.com?variable=nonexistent),預設值將顯示。

要確保不將多個值設置為預設值,如果有多個值被設置為預設,則 WordPress 請求預設時將顯示排在最前面的值。

3. 使用小工具或短碼請求網站加載自訂內容。有兩種方法顯示自訂內容,一種是使用「GET Custom Content小工具」將其放入側邊欄,另一種方法允許您在頁面的內容中使用短碼加載自訂內容,格式為[bg_gcc variable =“variableName”]。

4. 創建 URL。只需在文章或頁面的正常 URL 中添加「?variablename=valuename」,並將此 URL 提供給您希望查看您自訂內容的人。

如果要覆蓋特定變數組合的預設內容,可以使用相同的模式覆蓋變數/值組合,但使用「default」代替值名稱。例如,可以使用「- value-default」來顯示預設內容之外的內容。

若要在網站中插入 URL 的查詢變數值,可以在添加或編輯 GET Custom Content Variables 時,在描述中輸入該特定變數(在本示例中為「username」),在要填入值的位置輸入「VALUE」。例如,你可以輸入:“歡迎您,VALUE!”來顯示「歡迎您,Gretel!」。

外掛標籤

開發者團隊

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

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

原文外掛簡介

This plugin allows you to create custom content that appears in your WordPress posts depending on query variables in the URL. For example, appending \”?customer=yes\” to your URL can make the sidebar display the phrase \”We love our customers!\” while \”?customer=notyet\” can make the sidebar display \”Become our customer today!\”
The plugin includes a shortcode for insterting custom content into a page or post, as well as a widget for adding custom content to sidebars.
How to use:
After installing the plugin, you will find “GET Custom Content” in your dashboard menu.
There are just a few steps:

Create a Variable.
To create a variable, click “Custom Content Variables” under the “GET Custom Content” section of the Dashboard menu. Type a name for your variable, then click ‘add new variable.’

Create values for the variable
Click “New Value” under the “GET Custom Content” section of the Dashboard menu. Type the name of your value in the post title field, and type some content. Then select the variable to which this value belongs in the “GET Custom Content Variables” box on the editor screen.

If you want this particular value to be the default value, and therefore be shown when the variable is not defined in the URL, click the check box in the “Make this the Default?” box on the editor screen. It will appear if the variable is not defined in the URL (such as www.example.com) or when the variable is defined but the value does not exist (such as www.example.com?variable=nonexistent)
It’s up to you to make sure you don’t set up multiple values to be the default. If more than one value is set as the default, then whichever one is first when WordPress asks for the default will be shown as the default.

Use the widget or shortcode to ask the site to load the custom content
There are two ways to display custom content. One is to use the GET Custom Content widget to drop it in the sidebar. The second method allows you to load custom content in a page’s content using the shortcode, format [bg_gcc variable=”variableName”]

Create a URL. Just take a normal URL for your post or page, and add ?variablename=valuename and give this URL to people whom you would like to see your custom content.

Detailed instructions are here: http://bryangentry.us/get-custom-content-wordpress-plugin/
How can I override the default content defined for a particular variable combination?
The default content for the variable is displayed when the variable is not defined in the URL, or it is defined with a value that does not exist.
If you want to override this content in some place, use the same pattern for overriding a variable/value combination (see answer to previous question), but use “default” instead of the value name. Example:
-value-default
I want this shown instead of the default!
-value-default
How can I insert the URL’s query variable value into my site?
Sometimes you may want to use value in the user’s URL to display something on your page. For example, you might want the link example.com/my-page/?username=Gretel to display “Greetings, Gretel!” on the page. To do this, enter a description for the particular variable (in this case, username) back on the screen where you can add or edit GET Custom Content Variables. Include VALUE in the spot where you want the value to be filled in. For example, you could type:
Greetings, VALUE.

延伸相關外掛

文章
Filter
Mastodon