/** * Display a video. * * @since 1.0.0 * * @param array $args Optional. (width, height) * @param array $query_args Optional. Provider specific parameters. */ function the_audiotheme_video($args = array(), $query_args = array()) { echo get_audiotheme_video(get_the_ID(), $args, $query_args); }
/** * Set up JSON video data for use in JS. * * @since 1.0.0 */ function huesos_ajax_audiotheme_get_video_data() { wp_send_json(array('videoHtml' => get_audiotheme_video(absint($_GET['post_id'])))); exit; }
<?php /** * The template for displaying the featured video when enabled. * * @package Huesos * @since 1.0.0 */ ?> <div id="huesos-preview" class="huesos-preview has-preview fade-in responsive-video" data-featured-video-id="<?php echo esc_attr($featured_video); ?> "> <?php echo get_audiotheme_video($featured_video); ?> </div>
/** * Display a field to enter a video URL after the post title. * * @since 1.0.0 */ function audiotheme_video_after_title() { global $post; $video = get_audiotheme_video_url($post->ID); wp_nonce_field('save-video-meta_' . $post->ID, 'audiotheme_save_video_meta_nonce', false); ?> <div class="audiotheme-edit-after-title" style="position: relative"> <p> <label for="audiotheme-video-url" class="screen-reader-text"><?php _e('Video URL:', 'audiotheme'); ?> </label> <input type="text" name="_video_url" id="audiotheme-video-url" value="<?php echo esc_url($video); ?> " placeholder="<?php esc_attr_e('Video URL', 'audiotheme'); ?> " class="widefat"><br> <span class="description"> <?php printf(__('Enter a video URL from one of the %s.', 'audiotheme'), '<a href="https://codex.wordpress.org/Embeds#Okay.2C_So_What_Sites_Can_I_Embed_From.3F" target="_blank">' . __('supported video services', 'audiotheme') . '</a>'); ?> </span> </p> <div id="audiotheme-video-preview" class="audiotheme-video-preview<?php echo $video ? '' : ' audiotheme-video-preview-empty'; ?> "> <?php if ($video) { echo get_audiotheme_video($post->ID, array('width' => 600)); } else { _e('Save the video after entering a URL to preview it.', 'audiotheme'); } ?> </div> </div> <?php }
<?php /** * Template to display a Video widget. * * @package Huesos * @since 1.0.0 */ ?> <?php if (get_audiotheme_video_url($post->ID)) { ?> <figure class="entry-video responsive-video"> <?php echo get_audiotheme_video($post->ID); ?> </figure> <?php } ?> <?php if (!empty($title)) { printf(' <a href="%s">%s</a>', esc_url(get_permalink($post->ID)), $before_title . $title . $after_title); } ?> <?php if (!empty($link_text)) { $text .= sprintf(' <a class="more-link" href="%s">%s</a>', esc_url(get_permalink($post->ID)), $link_text);