[WordPress] 外掛分享: Register Settings API

首頁外掛目錄 › Register Settings API
10+
安裝啟用
★★★★★
5/5 分(2 則評價)
4096 天前
最後更新
問題解決
WordPress 4.0+ v1.4 上架:2014-12-09

內容簡介

此外掛可讓您在自己的 WordPress 主題或外掛程式中新增設定,只要撰寫陣列即可簡單完成。

完整說明文件請參考:http://www.wp-load.com/register-settings-api/

此外掛的優點

此外掛可以獨立使用,也可以作為您的主題或外掛程式的附加元件。
所有需要的東西都在一個檔案中。
不再需要花費時間在設定 API 上的操作,只要新增您的設定即可。
支援 Tinymce、textarea、checkboxes、radio buttons、url、color 和 email 等設定項目。
從陣列生成的選單和設定頁面都具備選項標籤和欄位功能。

完整範例,放置於 functions.php 或您的外掛程式中
add_filter('register_settings_api', 'settings_array');

function settings_array( $options_page ) {
$options_page['my-menu-slug'] = array(
'menu_title' => '我的選單',
'page_title' => '我的頁面',
'option_name' => 'my_options_slug',
'tabs' => array(
'first' => array(
'tab_title' => '我的第一個標籤',
'fields' => array(
'my_editor' => array(
'type' => 'tinymce',
'title' => '我的編輯器'
),
'my_color' => array(
'type' => 'color',
'title' => '我的色彩'
)
),
),
'second' => array(
'tab_title' => '我的第二個標籤',
'fields' => array(
'my_textarea' => array(
'type' => 'textarea',
'title' => '我的文字區域'
)
)
)
)
);
return $options_page;
}

外掛標籤

開發者團隊

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

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

原文外掛簡介

Add settings to your own theme or plugin. As simple as writing an array.
Full documentation at: http://www.wp-load.com/register-settings-api/
Benefits of the plugin

Work fine as a plugin OR as included to your theme or plugin.
Everything you need is in one single file.
No more fighting the settings API. Just add your settings and you are done.
Tinymce, textarea, checkboxes, radio buttons, url, color, email supported.
It will from the array create a menu and a settings page with tabs and fields.

Full example, placed in functions.php OR your plugin
add_filter('register_settings_api', 'settings_array');

function settings_array( $options_page ) {
$options_page['my-menu-slug'] = array(
'menu_title' => 'My menu',
'page_title' => 'My page',
'option_name' => 'my_options_slug',
'tabs' => array(
'first' => array(
'tab_title' => 'My first tab',
'fields' => array(
'my_editor' => array(
'type' => 'tinymce',
'title' => 'My editor'
),
'my_color' => array(
'type' => 'color',
'title' => 'My color'
)
),
),
'second' => array(
'tab_title' => 'My second tab',
'fields' => array(
'my_textarea' => array(
'type' => 'textarea',
'title' => 'My textarea'
)
)
)
)
);
return $options_page;
}

延伸相關外掛

文章
Filter
Apply Filters
Mastodon