我如何轻松添加metabox文件上传地点.Didnt想要使用插件。我已经添加了带文本的元数据但有文件上传我有点困惑。这里是添加文本元数据的代码
function cd_meta_box_music() {
global $wpdb;
$musicLink = get_post_meta(get_the_ID(), 'musicLink', true);
wp_nonce_field('my_meta_box_nonce', 'meta_box_nonce');
global $blog_id;
$posts = $wpdb->get_results('SELECT ID, post_title FROM wp_posts WHERE post_status = "publish" AND post_type = "video-list" ORDER BY ID DESC LIMIT 10000');
?>
<p>
<label for="musicLink">Put link here</label><br/>
<input style="margin-top: 15px;width:100%;" type="text" name="musicLink" value="<?php echo $musicLink; ?>"><br/>
</p><?php
$factstitle = get_post_meta(get_the_ID(), 'factstitle', true);?>
<p>
<label for="factstitle">Interesting facts title</label><br/>
<input style="margin-top: 15px;width:100%;" type="text" name="factstitle" value="<?php echo $factstitle; ?>"><br/>
</p><?php
$factssubtext = get_post_meta(get_the_ID(), 'factssubtext', true);?>
<p>
<label for="factstitle">Put interesting facts subtext here</label><br/>
<input style="margin-top: 15px;width:100%;" type="text" name="factssubtext" value="<?php echo $factssubtext; ?>"><br/>
</p><?php
?>
<?php
}
答案 0 :(得分:1)