[WordPress] 外掛分享: Meta Extension

首頁外掛目錄 › Meta Extension
10+
安裝啟用
尚無評分
5729 天前
最後更新
問題解決
WordPress 2.0.2+ v1.0.3 上架:2010-06-09

內容簡介

這個外掛基於 WordPress 內建的 meta 標籤,提供您輸入資訊的欄位並進行擴充。您可以修改外掛目錄中的 conf.txt,將自定義欄位加入到文章頁面中以添加文字欄位、文字區塊、下拉式選單、勾選框和單選框等等。

此外,這個外掛還整合了幾個熱門的 WordPress 外掛。例如,您可以使用 NextGen Gallery 的圖庫選取功能,在您的文章中添加圖庫 id 的 meta 欄位以在主題中運用。外掛還支援 WordTube 影片選擇功能以及 WP-Download Manager 開始發佈所以也支援下載資源的 id 管理。

然而,這只是外掛的簡單功能。Meta Extensions 還允許您根據欄位標題或內容自動添加標籤(請參閱 readme),並允許您設置勾選框以自動將文章添加或刪除類別。(設定檔可參考外掛目錄中的 conf.txt 文件。)

最新功能之一是,您可以將 conf.txt 檔案放置在當前主題的目錄中。這樣做可以在您的網站上運行多個主題以及有專屬的 conf.txt 檔案,以顯示該主題所需的特定欄位。如果在主題目錄中找不到檔案,它會從外掛目錄中的默認 conf.txt 檔案中提取。

相關連結:

外掛主頁面

任意部分
設定

欄位/元素類型:
textfield – HTML 表單文字欄位
textarea – HTML 表單文字區塊
checkbox – HTML 表單勾選框
radio – HTML 表單單選框
select – HTML 表單下拉選單
gallery – HTML 表單下拉選單以選擇 NextGen Gallery
video – HTML 表單下拉選單以選擇 Wordtube 影片
download – HTML 表單下拉選單以選擇 WordPress Download Manager 檔案

若要指定自訂欄位,請編輯 conf.txt 檔案。

每個輸入都以方括號中的主題開始。第二行指定其類型。第三行,只適用於類型 "radio" 和 "select",枚舉可用選項。每個選項之間都要用井號 (#) 分隔。您還可以為標準 HTML 表單實體包括一個預設值,以告訴它哪個是已選取或勾選的。 您也可以包括標籤選項,以便外掛自動將其添加為文章標籤。勾選框還有稱為 category_id 和 category_name 的獨特項目。這些是基於 WordPress 網站中現有的類別填充的。這可以用於在使用時自動將文章添加/刪除到輸入的類別 id(及其對應名稱以進行錯誤檢查)。

示例:

[方案]
type = textfield
subtitle = 在此輸入方案的一般名稱。

[喜歡的文章]
type = checkbox
category_id = 4
category_name = 專案方案

[步行里程]
type = radio
value = 0-9#10-19#20+
default = 0-9

[情緒狀態]
type = select
value = 高#中#低

[隱藏的想法]

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Meta Extension」→ 直接安裝(推薦)

原文外掛簡介

This plugin takes a simple concept of giving you fields to enter information that use the meta tags built into
Wordpress and expands on it. Modifying conf.txt in the plugin directory will allow you to enter custom fields to
the Posts pages to add textfields, textarea, dropdown selections, checkboxes, and radio selections.
On top of all this simplicity, it also integrates several popular WordPress plugins. With gallery selection for
NextGen Gallery you can select a gallery to save the id to a meta field for your post to pull in your theme. Support
for WordTube video selection is also added. WP-Download Manager is also supported in this initial release to get ids
for downloads as well.
Now while that may seem enough to make this a popular plugin, there is more. Meta Extensions allows you mark the
fields to auto add tags based on field title or content (explained in the readme). It also allows you to set up
checkboxes to add a post to/remove from a category automatically as wanted. All from the single conf.txt file included
with the plugin.
One of the latest features is the ability to place conf.txt in your current theme’s directory. By placing conf.txt in
the theme directories this allows you to run the plugin with multiple themes on your site and have custom conf.txt per
theme to only show the specific fields needed in that theme. If the file is not in the theme directory, it pulls from
the default conf.txt in the plugin’s directory.
Related Links:

Plugin Homepage

Arbitrary section
CONFIGURATION
Filed/Element Types:
textfield – HTML Form Textfield
textarea – HTML Form Textarea
checkbox – HTML Form Checkbox
radio – HTML Form Radio selections
select – HTML Form Select box
gallery – HTML Form Select box to choose a NextGen Gallery
video – HTML Form Select box to choose a Wordtube Video
download – HTML Form Select box to choose a WordPress Download Manager file
To specify the custom fields, edit the file conf.txt
Each entry begins with the subject inside square brackets. The second
line specifies its type. The third line, which only applies to type
“radio” and “select,” enumerates the available options. Each option
has to be separated by a hash mark (#). Each entry for standard HTML
form entities you can also include a default which tells it which to
mark as selected or checked. You can also include the tag option which
will tell the plugin to add the selection as a post tag automatically.
Tags are explained further down. Checkbox also has unique entries called
category_id and category_name. These are filled based on existing categories
in your WordPress site. This can be used to auto add/remove the post to the
entered category id (and it’s matching name for error checks) when used.
Ex.
[Plan]
type = textfield
subtitle = Enter the generic name of your plan here.
[Favorite Post]
type = checkbox
category_id = 4
category_name = Project Plans
[Miles Walked]
type = radio
value = 0-9#10-19#20+
default = 0-9
[Temper Level]
type = select
value = High#Medium#Low
[Hidden Thought]
type = textarea
rows = 4
cols = 40
[Picture Gallery]
type = gallery
tag = 0
[The Video]
type = video
tag = 0
[Attachment]
type = download
tag = 0
Tags can be very useful. Below is how each special type generates the
tag for it.
Tag Design:
textfield – Title of the entry when filled
textarea – Title of the entry when filled
checkbox – Title of the entry when checked
radio – The name of the selection
select – The name of the selection
gallery – Not handled
video – Not handled
Useage
Once you build your conf.txt file, you are ready to start making posts
using the custom fields. In order to call these fields you can either
use the built in get methods for post meta, or you can use the ones that
I have added to the metaext class to keep your code clean and know what
is what. Below is the current list of functions you can use in your theme
to call the meta information easily.
Meta Extensions Class:
metaext::get_single_metaext($meta_name, $limit)
Description: Creates a post object containing all the Posts with the meta_name passed being set in them.
$meta_name: the name in brackets for the field you want to pull the list of posts using this field.
$limit: how many of these posts to pull. Defaults to 5 if nothing is passed.
metaext::get_multi_metaext($meta_names, $limit)
Description: Creates a post object containing all the Posts the all the meta_names passed (meta_names is an array).
$meta_names: the names in brackets in an array for the fields you want to pull the list of posts using this field.
$limit: how many of these posts to pull. Defaults to 5 if nothing is passed.
metaext:: get_value_metaext($the_ID, $name)
Description: Gets the value for the passed name from the post id passed.
$the_ID: the post ID you are wanting to pull the custom field’s value from.
$name: The field name of the entry you want to pull the value for. The name is what is in [] and is case sensitive.
Meta Extensions WordPress Download Manager Class:
metaext_wpdm::get_metaext_downloadlink($id)
Description: Returns the download link for WPDM ID passed.
$id: The download ID (can use metaext::get_value_metaext() to get the ID) you want the link for.
metaext_wpdm::show_metaext_downloadlink($id)
Description: Echos the download link for WPDM ID passed.
$id: The download ID (can use metaext::get_value_metaext() to get the ID) you want the link for.
Meta Extensions NextGen Gallery Class:
metaext_ngg::get_metaext_firstpic($galleryid)
Description: Pulls the first image’s src link for the gallery id passed to it.
$galleryid: The gallery ID that you want to pull the first pic’s image url for.
metaext_ngg::show_metaext_firstpic($galleryid, $class = ”)
Description: Echos the first image’s src link for the gallery id passed to it using the optional class name passed.
$galleryid: The gallery ID that you want to pull the first pic’s image url for.
$class: The name of the class you want to use, optional.
metaext_ngg::show_metaext_gallery($galleryid)
Description: Echos the Gallery ID passed, the same as using the NGG show gallery shortcode.
$galleryid: The gallery ID that you want to show the gallery for.
Meta Extensions WordTube Class:
metaext_wt::get_metaext_wtvideo($videoid)
Description: Returns the Video code to show on a page for the video id passed.
$videoid: The video id to get the code for.
metaext_wt::show_metaext_wtvideo($videoid)
Description: Echos the Video code to show on a page for the video id passed.
$videoid: The video id to get the code for.
Code Examples

Test for Galleries using Meta Extensions with NextGen Gallery


Test for Videos using Meta Extensions with WordTube


Test for Downloads using Meta Extensions with WP Download Manager


延伸相關外掛

文章
Filter
Apply Filters
Mastodon