2013-03-29 04:35:41 +01:00
|
|
|
<?php
|
|
|
|
global $wp_embed;
|
|
|
|
$format_meta = get_post_format_meta( $post_ID );
|
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="post-format-description"></div>
|
2013-03-29 08:06:21 +01:00
|
|
|
<div class="post-formats-fields">
|
2013-03-29 04:35:41 +01:00
|
|
|
|
|
|
|
<input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
|
|
|
|
|
|
|
|
<div class="field wp-format-quote">
|
2013-04-09 19:08:25 +02:00
|
|
|
<label for="wp_format_quote"><?php _e( 'Quote' ); ?></label>
|
|
|
|
<textarea id="wp_format_quote" name="_wp_format_quote" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea>
|
2013-03-29 04:35:41 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field wp-format-quote">
|
2013-04-09 19:08:25 +02:00
|
|
|
<label for="wp_format_quote_source"><?php _e( 'Quote source' ); ?></label>
|
|
|
|
<input type="text" id="wp_format_quote_source" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_meta['quote_source'] ); ?>" class="widefat" />
|
2013-03-29 04:35:41 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$image = false;
|
2013-03-29 21:56:18 +01:00
|
|
|
if ( ! empty( $format_meta['image'] ) && is_numeric( $format_meta['image'] ) ) {
|
|
|
|
$format_meta['image'] = absint( $format_meta['image'] );
|
|
|
|
$image = wp_get_attachment_url( $format_meta['image'] );
|
|
|
|
}
|
2013-03-29 04:35:41 +01:00
|
|
|
?>
|
|
|
|
<div class="field wp-format-image">
|
|
|
|
<div data-format="image" class="wp-format-media-holder hide-if-no-js<?php if ( ! $image ) echo ' empty'; ?>">
|
|
|
|
<a href="#" class="wp-format-media-select"
|
|
|
|
data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>"
|
|
|
|
data-update="<?php esc_attr_e( 'Select Image' ); ?>">
|
|
|
|
<?php
|
|
|
|
if ( $image )
|
2013-04-09 19:12:47 +02:00
|
|
|
printf( '<img src="%s" alt="%s" />', esc_url( $image ), get_the_title( $format_meta['image'] ) );
|
2013-03-29 04:35:41 +01:00
|
|
|
else
|
|
|
|
_e( 'Select / Upload Image' );
|
|
|
|
?>
|
|
|
|
</a>
|
|
|
|
</div>
|
2013-04-07 18:49:56 +02:00
|
|
|
<input id="wp_format_image" type="hidden" name="_wp_format_image" value="<?php echo esc_attr( $format_meta['image'] ); ?>" />
|
2013-03-29 04:35:41 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field wp-format-link wp-format-quote wp-format-image">
|
2013-04-09 19:08:25 +02:00
|
|
|
<label for="wp_format_url"><?php _e( 'Link URL' ); ?></label>
|
|
|
|
<input type="text" id="wp_format_url" name="_wp_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" class="widefat" />
|
2013-03-29 04:35:41 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$show_video_preview = ! empty( $format_meta['video'] );
|
|
|
|
?>
|
2013-04-06 23:40:58 +02:00
|
|
|
<div class="field wp-format-video<?php if ( $show_video_preview ) echo ' has-media-preview'; ?>">
|
2013-03-29 04:35:41 +01:00
|
|
|
<?php if ( $show_video_preview ): ?>
|
|
|
|
<div id="video-preview" class="wp-format-media-preview">
|
|
|
|
<?php
|
|
|
|
if ( is_numeric( $format_meta['video'] ) ) {
|
|
|
|
$url = wp_get_attachment_url( $format_meta['video'] );
|
|
|
|
echo do_shortcode( sprintf( '[video src="%s"]', $url ) );
|
|
|
|
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['video'] ) ) {
|
|
|
|
echo do_shortcode( $format_meta['video'] );
|
|
|
|
} elseif ( ! preg_match( '#<[^>]+>#', $format_meta['video'] ) ) {
|
|
|
|
if ( strstr( $format_meta['video'], home_url() ) )
|
|
|
|
echo do_shortcode( sprintf( '[video src="%s"]', $format_meta['video'] ) );
|
|
|
|
else
|
|
|
|
echo $wp_embed->autoembed( $format_meta['video'] );
|
|
|
|
} else {
|
|
|
|
echo $format_meta['video'];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
2013-04-06 23:40:58 +02:00
|
|
|
<?php endif; ?>
|
2013-04-09 19:08:25 +02:00
|
|
|
<label for="wp_format_video"><?php _e( 'Video embed code or URL' ); ?></label>
|
2013-04-05 04:37:13 +02:00
|
|
|
<textarea id="wp_format_video" type="text" name="_wp_format_video" class="widefat"><?php esc_html_e( $format_meta['video'] ); ?></textarea>
|
2013-03-29 04:35:41 +01:00
|
|
|
<div data-format="video" class="wp-format-media-holder hide-if-no-js<?php if ( ! $image ) echo ' empty'; ?>">
|
|
|
|
<a href="#" class="wp-format-media-select"
|
|
|
|
data-choose="<?php esc_attr_e( 'Choose a Video' ); ?>"
|
|
|
|
data-update="<?php esc_attr_e( 'Select Video' ); ?>">
|
|
|
|
<?php _e( 'Select Video From Media Library' ) ?>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$show_audio_preview = ! empty( $format_meta['audio'] );
|
|
|
|
?>
|
|
|
|
<div class="field wp-format-audio<?php if ( $show_audio_preview ) echo ' has-media-preview' ?>">
|
|
|
|
<?php if ( $show_audio_preview ): ?>
|
|
|
|
<div id="audio-preview" class="wp-format-media-preview">
|
|
|
|
<?php
|
|
|
|
if ( is_numeric( $format_meta['audio'] ) ) {
|
|
|
|
$url = wp_get_attachment_url( $format_meta['audio'] );
|
|
|
|
echo do_shortcode( sprintf( '[audio src="%s"]', $url ) );
|
|
|
|
} elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $format_meta['audio'] ) ) {
|
|
|
|
echo do_shortcode( $format_meta['audio'] );
|
|
|
|
} elseif ( ! preg_match( '#<[^>]+>#', $format_meta['audio'] ) ) {
|
|
|
|
if ( strstr( $format_meta['audio'], home_url() ) )
|
|
|
|
echo do_shortcode( sprintf( '[audio src="%s"]', $format_meta['audio'] ) );
|
|
|
|
else
|
|
|
|
echo $wp_embed->autoembed( $format_meta['audio'] );
|
|
|
|
} else {
|
|
|
|
echo $format_meta['audio'];
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
2013-04-06 23:40:58 +02:00
|
|
|
<?php endif; ?>
|
2013-04-09 19:08:25 +02:00
|
|
|
<label for="wp_format_audio"><?php _e( 'Audio embed code or URL' ); ?></label>
|
2013-04-05 04:37:13 +02:00
|
|
|
<textarea id="wp_format_audio" name="_wp_format_audio" class="widefat"><?php esc_html_e( $format_meta['audio'] );
|
2013-03-29 04:35:41 +01:00
|
|
|
?></textarea>
|
|
|
|
<div data-format="audio" class="wp-format-media-holder hide-if-no-js<?php if ( empty( $format_meta['audio'] ) ) echo ' empty'; ?>">
|
|
|
|
<a href="#" class="wp-format-media-select" data-choose="<?php esc_attr_e( 'Choose Audio' ); ?>" data-update="<?php esc_attr_e( 'Select Audio' ); ?>">
|
|
|
|
<?php _e( 'Select Audio From Media Library' ) ?>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
2013-04-06 23:40:58 +02:00
|
|
|
</div>
|