我需要加载一个元框,以便编辑人员在编辑之前首先选择父帖子。但是没有看到我期望的宽元框,正常的编辑页面只是加载:这是wp admin/post new开头的代码。php:
if ( $post_type == \'news\' && !isset($_GET[\'parent_id\']) ):
//checking if parent_id exists on querystring
//Give them the news meta box only
add_action(\'add_meta_boxes\', function() { add_meta_box(\'news-parent\', \'Please select the Parent Project for this news:\', \'news_attributes_meta_box\', \'news\', \'normal\', \'high\');});//add wide meta box
function news_attributes_meta_box($post) {
$parentselectbox = wp_dropdown_pages(array(
\'post_type\' => \'project\',
\'name\' => \'parent_id\',
\'show_option_none\' => __(\'(no parent)\'),
\'sort_column\'=> \'menu_order,
post_title\',
\'echo\' => 0
));
if ( ! empty($parentselectbox) ) {
echo $parentselectbox;
} // end empty pages check
};
exit;//stop page load after meta box is loaded
//if chosen, give a move forward link with parent_id on querystring
endif;