starting metabox
This commit is contained in:
parent
db1fe2821e
commit
1cb662d6e6
|
@ -3,7 +3,25 @@
|
|||
class ComicPressPostMediaHandlingMetabox {
|
||||
function __comicpress_init() {
|
||||
$n = new ComicPressPostMediaHandlingMetabox();
|
||||
add_action('admin_menu', array(&$n, 'admin_menu'));
|
||||
}
|
||||
|
||||
function handle_update() {}
|
||||
|
||||
function admin_menu() {
|
||||
add_meta_box('comicpress-post-media-handling', __('ComicPress Post Media', 'comicpress'), array(&$this, 'metabox'), 'post', 'normal', 'low');
|
||||
}
|
||||
|
||||
function metabox() {
|
||||
global $post;
|
||||
$media_info = get_post_meta($post->ID, 'backend_url_images', true);
|
||||
if (!is_array($media_info)) {
|
||||
$media_info = array();
|
||||
}
|
||||
|
||||
$nonce = wp_create_nonce('comicpress');
|
||||
$action_nonce = wp_create_nonce('comicpress-post-media-update');
|
||||
|
||||
include('partials/post-media-handling/metabox.inc');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<input type="hidden" name="cp[_nonce]" value="<?php echo esc_attr($nonce) ?>" />
|
||||
<input type="hidden" name="cp[action]" value="post-media-update" />
|
||||
<input type="hidden" name="cp[_action_nonce]" value="<?php echo esc_attr($action_nonce) ?>" />
|
||||
<p>
|
||||
<em>Enter in relative or absolute URLs to the images you want to use for this post. This will override file system searches.</em>
|
||||
</p>
|
||||
<table class="widefat">
|
||||
<?php
|
||||
foreach (array(
|
||||
'comic' => __('Comic', 'comicpress'),
|
||||
'rss' => __('RSS', 'comicpress'),
|
||||
'archive' => __('Archive', 'comicpress'),
|
||||
'mini' => __('Mini', 'comicpress')
|
||||
) as $field => $label) {
|
||||
$value = isset($media_info[$field]) ? $media_info[$field] : '';
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php echo esc_html($label) ?> URL</th>
|
||||
<td>
|
||||
<input type="text" style="width:100%" name="cp[urls][<?php echo esc_attr($field) ?>]" value="<?php echo esc_attr($value) ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
?>
|
||||
</table>
|
Loading…
Reference in New Issue