本文整理汇总了PHP中wp_video_shortcode函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_video_shortcode函数的具体用法?PHP wp_video_shortcode怎么用?PHP wp_video_shortcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_video_shortcode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_the_post_video
/**
* Returns the featured video html, ready to echo.
*
* @since 1.0.0
*
* @param int $post_id
* @param string|array $size
*/
public function get_the_post_video($post_id = null, $size = null)
{
$post_id = null === $post_id ? get_the_ID() : $post_id;
if (!has_post_video($post_id)) {
return '';
}
$meta = get_post_meta($post_id, '_fvp_video', true);
$options = get_option('fvp-settings');
// Extract default and default->general options for easy access.
$defaults = !empty($options['default_args']) ? $options['default_args'] : array();
$general = !empty($defaults['general']) ? $defaults['general'] : array();
// Autoplay option. Suppressed when viewing admin.
$general['autoplay'] = (defined('DOING_AJAX') && DOING_AJAX || !is_admin()) && !empty($general['autoplay']) && $general['autoplay'] ? '1' : null;
// Responsive scaling option. Not used when viewing the admin screen.
$responsive = !empty($options['sizing']['responsive']) && $options['sizing']['responsive'] && (defined('DOING_AJAX') && DOING_AJAX || !is_admin());
// Alignment option
$align = !empty($options['alignment']) ? $options['alignment'] : 'center';
$args = array('id' => !empty($meta['id']) ? $meta['id'] : null, 'provider' => !empty($meta['provider']) ? $meta['provider'] : null);
$provider = $args['provider'];
switch ($provider) {
case 'local':
$img_meta = wp_get_attachment_metadata($meta['id']);
$size = $this->get_size($size, array('width' => !empty($img_meta['width']) ? $img_meta['width'] : null, 'height' => !empty($img_meta['height']) ? $img_meta['height'] : null));
$atts = array('src' => wp_get_attachment_url($meta['id']), 'autoplay' => $general['autoplay'] ? 'on' : null, 'loop' => !empty($general['loop']) ? 'on' : null, 'width' => $responsive ? $size['width'] * 8 : $size['width'], 'height' => $responsive ? $size['height'] * 8 : $size['height']);
$args = array_merge($args, $atts);
$embed = wp_video_shortcode($atts);
$embed = apply_filters('fvp-local', $embed, $args);
break;
case 'raw':
$embed = $meta['full'];
break;
default:
$atts = array_merge($general, $this->get_size($size), !empty($defaults[$provider]) ? $defaults[$provider] : array(), isset($meta['parameters']) ? $meta['parameters'] : array());
$args = array_merge($args, $atts);
$embed = $this->oembed->get_html($meta['full'], $atts, $provider);
$embed = apply_filters('fvp-oembed', $embed, $args);
break;
}
if (empty($embed)) {
return '';
}
$classnames = array('featured-video-plus' => true, 'post-thumbnail' => true, 'fvp-responsive' => $responsive);
$classnames['fvp-' . $provider] = !empty($provider);
$classnames['fvp-' . $align] = !empty($align);
$embed = sprintf("<!-- Featured Video Plus v%s -->\n<div%s>%s</div>\n\n", FVP_VERSION, FVP_HTML::class_names($classnames, true, true), $embed);
return $embed;
}
开发者ID:hell2310,项目名称:stylelk,代码行数:55,代码来源:class-main.php
示例2: while
while (have_posts()) {
the_post();
?>
<article <?php
post_class();
?>
>
<header class="entry-header">
<h1 class="entry-title"><?php
the_title();
?>
</h1>
</header><!-- .entry-header -->
<div class="entry-content entry-attachment">
<?php
echo wp_video_shortcode(array('src' => wp_get_attachment_url()));
?>
<p><strong><?php
_e('URL:', 'odin');
?>
</strong> <a href="<?php
echo wp_get_attachment_url();
?>
" title="<?php
the_title_attribute();
?>
" rel="attachment"><span><?php
echo basename(wp_get_attachment_url());
?>
</span></a></p>
开发者ID:brenoalvs,项目名称:odin,代码行数:31,代码来源:video.php
示例3: get_html
public function get_html($media)
{
if (!$media) {
return '';
}
$html = '';
$args = array('src' => mpp_get_media_src($media), 'poster' => mpp_get_media_src('thumbnail', $media));
return wp_video_shortcode($args);
}
开发者ID:baden03,项目名称:mediapress,代码行数:9,代码来源:media-view-video.php
示例4: tm_player
function tm_player($player = '', $args = array())
{
if (empty($player) || empty($args['files'])) {
return;
}
$defaults = array('files' => array(), 'poster' => '', 'autoplay' => false);
$args = wp_parse_args($args, $defaults);
extract($args);
/* JWPlayer */
if ($player == 'jwplayer') {
$options = array('file' => trim($files[0]), 'image' => $poster);
$atts = arr2atts($options);
$jwplayer_shortcode = '[jwplayer' . $atts . ']';
echo apply_filters('tm_video_filter', $jwplayer_shortcode);
} elseif ($player == 'flowplayer' && function_exists('flowplayer_content_handle')) {
$atts = array('splash' => $poster);
foreach ($files as $key => $file) {
$att = $key == 0 ? 'src' : 'src' . $key;
$atts[$att] = $file;
}
echo flowplayer_content_handle($atts, '', '');
tm_flowplayer_script();
} elseif ($player == 'videojs' && function_exists('video_shortcode')) {
$atts = array('poster' => $poster);
foreach ($files as $key => $file) {
$att = $key == 0 ? 'src' : 'src' . $key;
if (strpos($file, '.mp4') !== false) {
$atts['mp4'] = $file;
}
if (strpos($file, '.webm') !== false) {
$atts['webm'] = $file;
}
if (strpos($file, '.ogg') !== false) {
$atts['ogg'] = $file;
}
}
echo video_shortcode($atts, '', '');
tm_add_videojs_swf();
} else {
$atts = array();
foreach ($files as $file) {
$file = trim($file);
if (strpos($file, 'youtube.com') !== false) {
$atts['youtube'] = $file;
} else {
$type = wp_check_filetype($file, wp_get_mime_types());
$atts[$type['ext']] = $file;
}
}
echo wp_video_shortcode($atts);
}
}
开发者ID:venamax,项目名称:trixandtrax-cl,代码行数:52,代码来源:videos-functions.php
示例5: tzp_add_portfolio_post_media
/**
* This will add portfolio media content to the start of the content
* Override this functionality in a theme by removing the filter.
*
* @param string $content The content
* @return string The updated content
*/
function tzp_add_portfolio_post_media($content)
{
global $post;
if ($post->post_type == 'portfolio') {
$display_gallery = get_post_meta($post->ID, '_tzp_display_gallery', true);
$display_audio = get_post_meta($post->ID, '_tzp_display_audio', true);
$display_video = get_post_meta($post->ID, '_tzp_display_video', true);
if ($display_gallery || $display_audio || $display_video) {
$output = '<div class="portfolio-media">';
if ($display_gallery) {
$output .= tzp_portfolio_gallery($post->ID);
}
if ($display_audio) {
$poster = get_post_meta($post->ID, '_tzp_audio_poster_url', true);
if ($poster) {
$output .= sprintf('<img src="%1$s" alt="" />', esc_url($poster));
}
$mp3 = get_post_meta($post->ID, '_tzp_audio_file_mp3', true);
$ogg = get_post_meta($post->ID, '_tzp_audio_file_ogg', true);
$attr = array('mp3' => $mp3, 'ogg' => $ogg);
$output .= wp_audio_shortcode($attr);
}
if ($display_video) {
$embed = get_post_meta($post->ID, '_tzp_video_embed', true);
if ($embed) {
$output .= html_entity_decode(esc_html($embed));
} else {
$poster = get_post_meta($post->ID, '_tzp_video_poster_url', true);
$m4v = get_post_meta($post->ID, '_tzp_video_file_m4v', true);
$ogv = get_post_meta($post->ID, '_tzp_video_file_ogv', true);
$mp4 = get_post_meta($post->ID, '_tzp_video_file_mp4', true);
$attr = array('poster' => $poster, 'm4v' => $m4v, 'ogv' => $ogv, 'mp4' => $mp4);
$output .= wp_video_shortcode($attr);
}
}
$output .= '</div>';
return $output . $content;
}
return $content;
} else {
return $content;
}
}
开发者ID:TyRichards,项目名称:paradox,代码行数:50,代码来源:functions.php
示例6: wp_video_shortcode
</h3>
<?php
echo wp_video_shortcode(array('mp4' => 'https://s.w.org/images/core/4.7/edit-shortcuts-v1.mp4', 'poster' => 'https://s.w.org/images/core/4.7/edit-shortcuts.jpg?v2', 'loop' => true, 'autoplay' => true, 'width' => 2520, 'height' => 1454));
?>
<p><?php
_e('Visible icons appear to show you which parts of your site can be customized while live previewing. Click on a shortcut and get straight to editing. Paired with starter content, getting started with customizing your site is faster than ever.');
?>
</p>
</div>
<div class="col">
<h3><?php
_e('Video Headers');
?>
</h3>
<?php
echo wp_video_shortcode(array('mp4' => 'https://s.w.org/images/core/4.7/header-video-v1.mp4', 'poster' => 'https://s.w.org/images/core/4.7/header-video.jpg?v2', 'loop' => true, 'autoplay' => true, 'width' => 2520, 'height' => 1454));
?>
<p><?php
_e('Sometimes a big atmospheric video as a moving header image is just what you need to showcase your wares; go ahead and try it out with Twenty Seventeen. Need some video inspiration? Try searching for sites with video headers available for download and use.');
?>
</p>
</div>
</div>
<div class="feature-section two-col">
<div class="col">
<h3><?php
_e('Smoother Menu Building');
?>
</h3>
<img src="https://s.w.org/images/core/4.7/nav-menus-760.jpg?v2" srcset="https://s.w.org/images/core/4.7/nav-menus-760.jpg?v2 760w, https://s.w.org/images/core/4.7/nav-menus-280.jpg?v2 280w, https://s.w.org/images/core/4.7/nav-menus-536.jpg?v2 536w, https://s.w.org/images/core/4.7/nav-menus-745.jpg?v2 745w" sizes="(max-width: 500px) calc(100vw - 40px), (max-width: 781px) calc((100vw - 70px) * .466), (max-width: 959px) calc((100vw - 116px) * .469), (max-width: 1290px) calc((100vw - 240px) * .472), 496px" alt="" />
开发者ID:kucrut,项目名称:wordpress,代码行数:31,代码来源:about.php
示例7: switch
</h2>
<?php
if ($video_type_option != '') {
switch ($video_type_option) {
case 'youtubelink':
$clipid = get_post_meta($post->ID, 'video_youtube_link', true);
echo iva_youtube(array('clipid' => $clipid, 'width' => '', 'height' => '600'));
break;
case 'vimeolink':
$clipid = get_post_meta($post->ID, 'video_vimeo_link', true);
echo iva_vimeo(array('clip_id' => $clipid, 'width' => '', 'height' => '600'));
break;
case 'selfvideo':
$clipid = get_post_meta($post->ID, 'video_selfhost_video', true);
echo wp_video_shortcode(array('src' => $clipid, 'autoplay' => '', 'height' => 470, 'width' => empty($content_width) ? 740 : $content_width));
break;
}
}
?>
</div><!-- .custompost_details -->
</div><!-- .custompost_entry -->
<div class="demospace" style="height:20px;"></div>
<?php
the_content();
?>
<?php
开发者ID:pryspry,项目名称:MusicPlay,代码行数:31,代码来源:single-video.php
示例8: edit_form_image_editor
/**
* Displays the image and editor in the post editor
*
* @since 3.5.0
*/
function edit_form_image_editor($post)
{
$open = isset($_GET['image-editor']);
if ($open) {
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
}
$thumb_url = false;
if ($attachment_id = intval($post->ID)) {
$thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 450), true);
}
$alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
$att_url = wp_get_attachment_url($post->ID);
?>
<div class="wp_attachment_holder">
<?php
if (wp_attachment_is_image($post->ID)) {
$image_edit_button = '';
if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
$nonce = wp_create_nonce("image_editor-{$post->ID}");
$image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <span class='spinner'></span>";
}
?>
<div class="imgedit-response" id="imgedit-response-<?php
echo $attachment_id;
?>
"></div>
<div<?php
if ($open) {
echo ' style="display:none"';
}
?>
class="wp_attachment_image" id="media-head-<?php
echo $attachment_id;
?>
">
<p id="thumbnail-head-<?php
echo $attachment_id;
?>
"><img class="thumbnail" src="<?php
echo set_url_scheme($thumb_url[0]);
?>
" style="max-width:100%" alt="" /></p>
<p><?php
echo $image_edit_button;
?>
</p>
</div>
<div<?php
if (!$open) {
echo ' style="display:none"';
}
?>
class="image-editor" id="image-editor-<?php
echo $attachment_id;
?>
">
<?php
if ($open) {
wp_image_editor($attachment_id);
}
?>
</div>
<?php
} elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'audio/')) {
wp_maybe_generate_attachment_metadata($post);
echo wp_audio_shortcode(array('src' => $att_url));
} elseif ($attachment_id && 0 === strpos($post->post_mime_type, 'video/')) {
wp_maybe_generate_attachment_metadata($post);
$meta = wp_get_attachment_metadata($attachment_id);
$w = !empty($meta['width']) ? min($meta['width'], 640) : 0;
$h = !empty($meta['height']) ? $meta['height'] : 0;
if ($h && $w < $meta['width']) {
$h = round($meta['height'] * $w / $meta['width']);
}
$attr = array('src' => $att_url);
if (!empty($w) && !empty($h)) {
$attr['width'] = $w;
$attr['height'] = $h;
}
$thumb_id = get_post_thumbnail_id($attachment_id);
if (!empty($thumb_id)) {
$attr['poster'] = wp_get_attachment_url($thumb_id);
}
echo wp_video_shortcode($attr);
}
?>
</div>
<div class="wp_attachment_details edit-form-section">
<p>
<label for="attachment_caption"><strong><?php
_e('Caption');
?>
</strong></label><br />
//.........这里部分代码省略.........
开发者ID:HaraShun,项目名称:WordPress,代码行数:101,代码来源:media.php
示例9: pods_video
/**
* Output a video field as a video player.
*
* @uses wp_video_shortcode()
*
* @since 2.5
*
* @param string|array $url Can be a URL of the source file, or a Pods video field.
* @param bool|array $args Optional. Additional arguments to pass to wp_video_shortcode()
*
* @return string
*/
function pods_video($url, $args = false)
{
if (is_array($url)) {
if (!is_null(pods_v('ID', $url))) {
$id = pods_v('ID', $url);
$url = wp_get_attachment_url($id);
} else {
return;
}
}
$video_args = array('src' => $url);
if (is_array($args)) {
$video_args = array_merge($video_args, $args);
}
return wp_video_shortcode($video_args);
}
开发者ID:dylansmithing,项目名称:leader-of-rock-wordpress,代码行数:28,代码来源:media.php
示例10: array_pop
// Exit if the file is accessed directly over web
if (!defined('ABSPATH')) {
exit;
}
/**
* List videos attached to activity
*
*/
?>
<div class=" mpp-activity-media-list mpp-activity-video-list mpp-activity-video-player">
<?php
$ids = $media_ids;
//is there only one video attached?
if (count($ids) == 1) {
$ids = array_pop($ids);
$media = mpp_get_media($ids);
$args = array('src' => mpp_get_media_src('', $media), 'poster' => mpp_get_media_src('thumbnail', $media));
//show single video with poster
echo wp_video_shortcode($args);
} else {
//show all videos as playlist
echo wp_playlist_shortcode(array('ids' => $ids, 'type' => 'video'));
}
?>
<script type='text/javascript'>
mpp_mejs_activate(<?php
echo bp_get_activity_id();
?>
);
</script>
</div>
开发者ID:markc,项目名称:mediapress,代码行数:31,代码来源:playlist-video.php
示例11: get_video_player
/**
* Wrapper for wp_oembed_get/wp_video_shortcode
*
* @since 0.1.1
*
* @param array $args Optional. Args are passed to either WP_Embed::shortcode,
* or wp_video_shortcode.
* @return mixed The video player if successful.
*/
public function get_video_player($args = array())
{
global $wp_embed;
$media = empty($this->media) ? $this->init_media() : $this->media;
$video = isset($media['video']) ? $media['video'] : array();
if (!isset($video['type'])) {
return '';
}
$video_url = '';
if ('url' === $video['type']) {
$wp_embed->post_ID = $this->ID;
$video_player = $wp_embed->shortcode($args, $video['value']);
} elseif ('attachment_id' === $video['type']) {
$args['src'] = $video['attachment_url'];
if ($video_player = wp_video_shortcode($args)) {
$video_player = '<div class="gc-video-wrap">' . $video_player . '</div><!-- .gc-video-wrap -->';
}
}
return $video_player;
}
开发者ID:jtsternberg,项目名称:gc-sermons,代码行数:29,代码来源:class-sermon-post.php
示例12: powerpressplayer_build_mediaelementvideo
function powerpressplayer_build_mediaelementvideo($media_url, $EpisodeData = array(), $embed = false)
{
if (!function_exists('wp_video_shortcode')) {
// Return the HTML5 video shortcode instead
return powerpressplayer_build_html5video($media_url, $EpisodeData, $embed);
}
$player_id = powerpressplayer_get_next_id();
$cover_image = '';
$player_width = '';
$player_height = '';
$autoplay = false;
// Global Settings
$Settings = get_option('powerpress_general');
if (!empty($Settings['player_width'])) {
$player_width = $Settings['player_width'];
}
if (!empty($Settings['player_height'])) {
$player_height = $Settings['player_height'];
}
if (!empty($Settings['poster_image'])) {
$cover_image = $Settings['poster_image'];
}
// Episode Settings
if (!empty($EpisodeData['image'])) {
$cover_image = $EpisodeData['image'];
}
if (!empty($EpisodeData['width'])) {
$player_width = $EpisodeData['width'];
}
if (!empty($EpisodeData['height'])) {
$player_height = $EpisodeData['height'];
}
if (!empty($EpisodeData['autoplay'])) {
$autoplay = true;
}
if ($embed) {
$player_height = '123';
$player_width = '456';
}
$content = '';
$content .= '<div class="powerpress_player" id="powerpress_player_' . $player_id . '">' . PHP_EOL;
$attr = array('src' => $media_url, 'poster' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'none');
// , 'width'=>'', 'height'=>'');
if (!empty($player_width)) {
$attr['width'] = $player_width;
}
if (!empty($player_height)) {
$attr['height'] = $player_height;
}
if (!empty($cover_image)) {
$attr['poster'] = $cover_image;
}
if (!empty($autoplay)) {
$attr['autoplay'] = 'on';
}
if (!empty($EpisodeData['webm_src'])) {
$attr['webm'] = powerpress_add_flag_to_redirect_url($EpisodeData['webm_src'], 'p');
}
$shortcode = wp_video_shortcode($attr);
if ($embed) {
$shortcode = str_replace(array('"123"', '"456"', '456px;'), array('"100%"', '"100%"', '100%;'), $shortcode);
}
$content .= $shortcode;
$content .= '</div>' . PHP_EOL;
return $content;
}
开发者ID:briancfeeney,项目名称:portigal,代码行数:66,代码来源:powerpress-player.php
示例13: _e
<h4><?php _e( 'Do more with audio and video' ); ?></h4>
<p><?php _e( 'Images have galleries; now we’ve added simple audio and video playlists, so you can showcase your music and clips.' ); ?></p>
</div>
</div>
</div>
<hr>
<div class="changelog customize">
<div class="feature-section col two-col">
<div>
<?php
echo wp_video_shortcode( array(
'mp4' => '//s.w.org/images/core/3.9/widgets.mp4',
'ogv' => '//s.w.org/images/core/3.9/widgets.ogv',
'webm' => '//s.w.org/images/core/3.9/widgets.webm',
'loop' => true,
'autoplay' => true,
'width' => 499
) );
?>
<h4><?php _e( 'Live widget and header previews' ); ?></h4>
<p><?php _e( 'Add, edit, and rearrange your site’s widgets right in the theme customizer. No “save and surprise” — preview your changes live and only save them when you’re ready.' ); ?></p>
<p><?php _e( 'The improved header image tool also lets you upload, crop, and manage headers while customizing your theme.' ); ?></p>
</div>
<div class="last-feature">
<img src="//s.w.org/images/core/3.9/theme.jpg?0" />
<h4><?php _e( 'Stunning new theme browser' ); ?></h4>
<p><?php _e( 'Looking for a new theme should be easy and fun. Lose yourself in the boundless supply of free WordPress.org themes with the beautiful new theme browser.' ); ?></p>
<?php if ( current_user_can( 'install_themes' ) ) { ?>
<p><a href="<?php echo network_admin_url( 'theme-install.php' ); ?>" class="button button-large button-primary"><?php _e( 'Browse Themes' ); ?></a></p>
<?php } ?>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:32,代码来源:about.php
示例14: the_candidate_video
/**
* Output the candidate video
*/
function the_candidate_video($post = null)
{
$video = get_the_candidate_video($post);
$video = is_ssl() ? str_replace('http:', 'https:', $video) : $video;
$filetype = wp_check_filetype($video);
if (!empty($filetype['ext'])) {
$video_embed = wp_video_shortcode(array('src' => $video));
} else {
$video_embed = wp_oembed_get($video);
}
if ($video_embed) {
echo '<div class="candidate-video">' . $video_embed . '</div>';
}
}
开发者ID:vinodhip,项目名称:Function-22-Website,代码行数:17,代码来源:wp-resume-manager-template.php
示例15: _e
<hr />
<div class="feature-section col two-col">
<div class="col-1">
<h3><?php _e( 'Focus on your content' ); ?></h3>
<p><?php _e( 'Writing and editing is smoother and more immersive with an editor that expands to fit your content as you write, and keeps the formatting tools available at all times.' ); ?></p>
</div>
<div class="col-2 last-feature">
<div class="about-video about-video-focus">
<?php
echo wp_video_shortcode( array(
'mp4' => '//s.w.org/images/core/4.0/focus.mp4',
'ogv' => '//s.w.org/images/core/4.0/focus.ogv',
'webm' => '//s.w.org/images/core/4.0/focus.webm',
'loop' => true,
'autoplay' => true,
'width' => 500,
'height' => 281
) );
?>
</div>
</div>
</div>
<hr />
<div class="feature-section col two-col">
<div class="col-1">
<img src="//s.w.org/images/core/4.0/plugins.png" />
</div>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:about.php
示例16: dt_sc_post
function dt_sc_post($attrs, $content = null)
{
extract(shortcode_atts(array('id' => '1', 'read_more_text' => __('Read More', 'dt_themes'), 'excerpt_length' => 10, 'columns' => 1), $attrs));
$p = get_post($id, 'ARRAY_A');
$link = get_permalink($id);
$format = get_post_format($id);
$title = $p['post_title'];
$author_id = $p['post_author'];
$class = get_post_class("blog-entry no-border", $id);
$class = implode(" ", $class);
$tags = "";
$terms = wp_get_post_tags($id);
$post_meta = is_array(get_post_meta($id, '_dt_post_settings', TRUE)) ? get_post_meta($id, '_dt_post_settings', TRUE) : array();
if (!empty($terms)) {
$tags .= '<p class="tags"><i class="fa fa-tags"> </i>';
foreach ($terms as $term) {
$tags .= '<a href="' . get_term_link($term->slug, 'post_tag') . '"> ' . $term->name . '</a>,';
}
$tags = substr($tags, 0, -1);
$tags .= '</p> <span> | </span> ';
}
$thumbnail_sidebar = '';
$tpl_default_settings = get_post_meta(get_the_ID(), '_tpl_default_settings', TRUE);
$tpl_default_settings = is_array($tpl_default_settings) ? $tpl_default_settings : array();
$page_layout = array_key_exists("layout", $tpl_default_settings) ? $tpl_default_settings['layout'] : "content-full-width";
if ($page_layout == 'with-left-sidebar' || $page_layout == 'with-right-sidebar') {
$thumbnail_sidebar = '-single-sidebar';
} elseif ($page_layout == 'both-sidebar') {
$thumbnail_sidebar = '-both-sidebar';
}
if ($columns == 2) {
if ($thumbnail_sidebar == "-single-sidebar") {
$post_thumbnail = 'blog-two-column';
} else {
$post_thumbnail = 'blogcourse-two-column';
}
} elseif ($columns == 3) {
$post_thumbnail = 'blogcourse-three-column';
} else {
$post_thumbnail = 'blog-one-column';
}
$post_thumbnail = $post_thumbnail . $thumbnail_sidebar;
$out = '<article class="' . esc_attr($class) . '">';
$out .= ' <div class="blog-entry-inner">';
$out .= ' <div class="entry-thumb">';
if ($format === "image" || empty($format)) {
$out .= '<a href="' . esc_url($link) . '">';
if (has_post_thumbnail($id)) {
$out .= get_the_post_thumbnail($id, $post_thumbnail);
} else {
$out .= '<img src="http://placehold.it/1170x822&text=Image" alt="' . $title . '" />';
}
$out .= "</a>";
} elseif ($format === "gallery" && array_key_exists("items", $post_meta)) {
$out .= "<ul class='entry-gallery-post-slider'>";
foreach ($post_meta['items'] as $item) {
$attachment_id = dt_get_attachment_id_from_url($item);
$img_attributes = wp_get_attachment_image_src($attachment_id, $post_thumbnail);
$out .= "<li><img src='" . $img_attributes[0] . "' width='" . $img_attributes[1] . "' height='" . $img_attributes[2] . "' /></li>";
}
$out .= "</ul>";
} elseif ($format === "video" && (array_key_exists('oembed-url', $post_meta) || array_key_exists('self-hosted-url', $post_meta))) {
if (array_key_exists('oembed-url', $post_meta)) {
$out .= "<div class='dt-video-wrap'>" . wp_oembed_get($post_meta['oembed-url']) . '</div>';
} elseif (array_key_exists('self-hosted-url', $post_meta)) {
$out .= "<div class='dt-video-wrap'>" . wp_video_shortcode(array('src' => $post_meta['self-hosted-url'])) . '</div>';
}
} elseif ($format === "audio" && (array_key_exists('oembed-url', $post_meta) || array_key_exists('self-hosted-url', $post_meta))) {
if (array_key_exists('oembed-url', $post_meta)) {
$out .= wp_oembed_get($post_meta['oembed-url']);
} elseif (array_key_exists('self-hosted-url', $post_meta)) {
$out .= wp_audio_shortcode(array('src' => $post_meta['self-hosted-url']));
}
} else {
$out .= '<a href="' . esc_url($link) . '">';
if (has_post_thumbnail($id)) {
$out .= get_the_post_thumbnail($id, $post_thumbnail);
} else {
$out .= '<img src="http://placehold.it/1170x822&text=Image" alt="' . $title . '" />';
}
$out .= "</a>";
}
$excerpt = explode(' ', do_shortcode($p['post_content']), $excerpt_length);
$excerpt = array_filter($excerpt);
if (!empty($excerpt)) {
if (count($excerpt) >= $excerpt_length) {
array_pop($excerpt);
$excerpt = implode(" ", $excerpt) . '...';
} else {
$excerpt = implode(" ", $excerpt);
}
$excerpt = preg_replace('`\\[[^\\]]*\\]`', '', $excerpt);
$out .= '<div class="entry-thumb-desc"><p>' . $excerpt . '</p></div>';
}
$out .= ' </div> <!-- .entry-thumb -->';
$out .= ' <div class="entry-details">';
if (is_sticky()) {
$out .= '<div class="featured-post"> <span class="fa fa-trophy"> </span> <span class="text">' . __('Featured', 'dt_themes') . '</span></div>';
}
$out .= ' <div class="entry-meta">';
//.........这里部分代码省略.........
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:101,代码来源:shortcodes.php
示例17: render
protected function render()
{
$settings = $this->get_settings();
if ('hosted' !== $settings['video_type']) {
add_filter('oembed_result', [$this, 'filter_oembed_result'], 50, 3);
$video_link = 'youtube' === $settings['video_type'] ? $settings['link'] : $settings['vimeo_link'];
if (empty($video_link)) {
return;
}
$video_html = wp_oembed_get($video_link, wp_embed_defaults());
remove_filter('oembed_result', [$this, 'filter_oembed_result'], 50);
} else {
$video_html = wp_video_shortcode($this->get_hosted_params());
}
if ($video_html) {
?>
<div class="elementor-video-wrapper">
<?php
echo $video_html;
if ($this->has_image_overlay()) {
?>
<div class="elementor-custom-embed-image-overlay" style="background-image: url(<?php
echo $settings['image_overlay']['url'];
?>
);">
<?php
if ('yes' === $settings['show_play_icon']) {
?>
<div class="elementor-custom-embed-play">
<i class="fa fa-play-circle"></i>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
} else {
echo $settings['link'];
}
}
开发者ID:pojome,项目名称:elementor,代码行数:44,代码来源:video.php
示例18: test_wp_video_shortcode_attributes
/**
* @ticket 35367
* @depends test_video_shortcode_body
*/
function test_wp_video_shortcode_attributes()
{
$actual = wp_video_shortcode(array('src' => 'https://example.com/foo.mp4'));
$this->assertContains('src="https://example.com/foo.mp4', $actual);
$this->assertNotContains('loop', $actual);
$this->assertNotContains('autoplay', $actual);
$this->assertContains('preload="metadata"', $actual);
$this->assertContains('width="640"', $actual);
$this->assertContains('height="360"', $actual);
$this->assertContains('class="wp-video-shortcode"', $actual);
$actual = wp_video_shortcode(array('src' => 'https://example.com/foo.mp4', 'poster' => 'https://example.com/foo.png', 'loop' => true, 'autoplay' => true, 'preload' => true, 'width' => 123, 'height' => 456, 'class' => 'foobar'));
$this->assertContains('src="https://example.com/foo.mp4', $actual);
$this->assertContains('poster="https://example.com/foo.png', $actual);
$this->assertContains('loop="1"', $actual);
$this->assertContains('autoplay="1"', $actual);
$this->assertContains('preload="1"', $actual);
$this->assertContains('width="123"', $actual);
$this->assertContains('height="456"', $actual);
$this->assertContains('class="foobar"', $actual);
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:24,代码来源:media.php
示例19: get_post_meta
<div class="dt-sc-clear"></div>
<div class="dt-sc-hr-invisible"></div>
<?php
$course_video = get_post_meta($the_id, 'course-video', true);
if (isset($course_video) && $course_video != '') {
?>
<h4 class="border-title"><?php
_e('Course Intro Video', 'dt_themes');
?>
<span></span></h4>
<div class="course-video"><?php
if (wp_oembed_get($course_video) != '') {
echo wp_oembed_get($course_video);
} else {
echo wp_video_shortcode(array('src' => $course_video));
}
?>
</div>
<div class="dt-sc-clear"></div>
<div class="dt-sc-hr-invisible-medium"></div>
<?php
}
?>
<?php
$lessons_array = $staffs_id = array();
$lesson_args = array('sort_order' => 'ASC', 'sort_column' => 'menu_order', 'hierarchical' => 1, 'post_type' => 'dt_lessons', 'posts_per_page' => -1, 'meta_key' => 'dt_lesson_course', 'meta_value' => $the_id);
$lessons_array = get_pages($lesson_args);
if (isset($lessons_array) && !empty($lessons_array)) {
echo '<div class="dt-lesson-wrapper">
开发者ID:PNW3DEV,项目名称:iesdb-v1,代码行数:31,代码来源:single-dt_courses.php
示例20: get_video_embed
static function get_video_embed($args = array(), $conditonal_args = array(), $current_page = array())
{
global $wp_embed;
$video_url = esc_url($args['video_url']);
$autoembed = $wp_embed->autoembed($video_url);
$is_local_video = has_shortcode($autoembed, 'video');
$video_embed = '';
if ($is_local_video) {
$video_embed = wp_video_shortcode(array('src' => $video_url));
} else {
$video_embed = wp_oembed_get($video_url);
$video_embed = preg_replace('/<embed /', '<embed wmode="transparent" ', $video_embed);
$video_embed = preg_replace('/<\\/object>/', '<param name="wmode" value="transparent" /></object>', $video_embed);
}
return $video_embed;
}
开发者ID:pacificano,项目名称:pacificano,代码行数:16,代码来源:main-modules.php
注:本文中的wp_video_shortcode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论