0
我正在構建一個Wordpress博客,需要在每個帖子管理頁面上有一個管理面板的自定義幻燈片系統(有點像Yoast的SEO插件如何在每個頁面上有選項)。你如何讓wordpress插件擁有「每帖」選項?
我將如何讓admin選項出現在帖子管理頁面上?
感謝,
查理
我正在構建一個Wordpress博客,需要在每個帖子管理頁面上有一個管理面板的自定義幻燈片系統(有點像Yoast的SEO插件如何在每個頁面上有選項)。你如何讓wordpress插件擁有「每帖」選項?
我將如何讓admin選項出現在帖子管理頁面上?
感謝,
查理
您沒有提供太多細節有關的項目,但你可能want to make some meta_boxes,並將數據保存爲custom fields。
這裏是截斷的例子culled from something I put together for a question at wordpress.stackexchange。一些功能的細節對於你的問題並不重要,但它說明了一般的'如何'。按照鏈接工作,但真誠的測試代碼。
// author checkboxes
add_action('add_meta_boxes', 'assisting_editor');
function assisting_editor() {
add_meta_box(
'assisting_editor', // id, used as the html id att
__('Editorial Tasks'), // meta box title
'editor_tasks', // callback function, spits out the content
'post', // post type or page. This adds to posts only
'side', // context, where on the screen
'low' // priority, where should this go in the context
);
}
// this is the callback that creates the meta box content
function editor_tasks($post) {
// function details skipped; follow the link
}
// to save the data
add_action('save_post', 'save_metadata');
// callback for the save hook ^^
function save_metadata($postid) {
// function details skipped; follow the link
}