[WordPress] 外掛分享: Spiffy Meta Box Creator

首頁外掛目錄 › Spiffy Meta Box Creator
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
10+
安裝啟用
尚無評分
4442 天前
最後更新
問題解決
WordPress 2.0.2+ v1.1.0 上架:2011-08-04

內容簡介

這個外掛讓你可以透過建立及調用一個函數,而無需重複使用所有相同的 WordPress 函數來創建 Meta Box。

任意部分

以下是一個範例 Meta Box 函數:

< ?php

//用於頁面設置的 Meta Box
function pageSettings() {

//Meta Box 的名稱(小寫,不含空格)
$name = ''page_settings';

//輸入每個框的標題
$titles = array('Section Headline');

//這會將標題運行通過函數,將其轉換為表單字段的標籤。
$boxes = makeTitles($name,$titles);

//Meta Box 的說明
$desc = ''Page Settings';

//在哪些頁面上顯示:
$types = array('page');

//拉取現有的 Meta Field 值
$setHeadline = get_post_meta($_GET['post'],"_page_settings_section_headline",true);

$content = "Page Headline:”;
$content .= "“”;

// 運行函數
$config = array(
'name'=>$name,
'boxes'=>$boxes,
'desc'=>$desc,
'type'=>$type,
'content'=>$content
);

//創建對象
newMetaBox($config);
}

//運行
pageSettings();

?>

外掛標籤

開發者團隊

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

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

原文外掛簡介

This plugin lets you create meta boxes by creating and calling a function but without needing to reuse all of the same WordPress functions for doing so.
Arbitrary section
Here is an example meta box function:
< ?php //Meta box for page settings function pageSettings() { //Name of the meta box (lowercase without spaces) $name = 'page_settings'; //Enter the titles for each one of your boxes $titles = array('Section Headline'); //This will run the titles through a function that converts them into lables for the form fields. $boxes = makeTitles($name,$titles); //Description of meta box $desc = 'Page Settings'; //Show on page type: $types = array('page'); //Pull in existing meta field value $setHeadline = get_post_meta($_GET['post'],"_page_settings_section_headline",true); $content = "Page Headline:”; $content .= “”; //Run the function $config = array( ‘name’=>$name,
‘boxes’=>$boxes,
‘desc’=>$desc,
‘type’=>$type,
‘content’=>$content
);
//Create the object
newMetaBox($config);
}
//Run it
pageSettings();
?>

延伸相關外掛

文章
Filter
Mastodon