Wordpress Custom Themes > How to script Categories, Tags and Excerpt options to appear on "page" editor
I'm using custom WordPress categories for some probably unintended functions, I will admit (things like marking a post no/index just by adding it to my custom "no-index" category, etc). But it sucks that WordPress does not enable pages with all the little extras yo开发者_JAVA技巧u get with posts.
For example, while the post editor gives you convenient access to Tags, Categories, and a Post excerpt field, pages get left out in the cold.
I'd like to know if its possible to add the These items to the Post editor via add_action() directive from a custom theme.
The following will add category and excerpt panels.
add_action('admin_menu', 'my_page_excerpt_meta_box');
add_action('admin_menu', 'my_page_categories_meta_box');
function my_page_excerpt_meta_box() {
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'page', 'normal', 'core');
}
function my_page_categories_meta_box() {
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'page', 'side', 'core');
}
精彩评论