內容簡介
這個外掛讓你可以透過建立及調用一個函數,而無需重複使用所有相同的 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();
?>
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
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();
?>
