我想在wordpress中添加html select到post-new.php和Edit.php,所以我制作了php-file.php并将其包含在主题function.php中
但html选择始终显示在页面顶部
我如何在默认项目下设置它(在帖子标题和帖子描述下)?
// ============================== Add Province And City ...
add_action( 'add_meta_boxes', 'selectIranProvinceCity' );
// add_action( 'update_post_meta', 'selectIranProvinceCity' );
add_action( 'save_post', 'iranProvinceCitySavePostData' );
function selectIranProvinceCity(){
// Load Province And City
require_once( 'iran_province_city.php' );
}
function iranProvinceCitySavePostData($post_id){
// Save Province And City
$province = '';
$city = '';
// $post_id = get_the_ID();
if( isset( $_POST['state'] ) ) {
$province = $_POST['state'];
if( !add_post_meta($post_id, 'job_province', $province, true ) ) {
update_post_meta($post_id, 'job_province', $province );
}
}
if( isset( $_POST['city'] ) ) {
$city = $_POST['city'];
if( !add_post_meta($post_id, 'job_city', $city, true ) ) {
update_post_meta($post_id, 'job_city', $city );
}
}
}
// ============================== Add Province And City .
答案 0 :(得分:0)
使用插件添加组合框。 使用高级自定义文件插件。