本文整理汇总了PHP中et_get_first_video函数的典型用法代码示例。如果您正苦于以下问题:PHP et_get_first_video函数的具体用法?PHP et_get_first_video怎么用?PHP et_get_first_video使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了et_get_first_video函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: et_pb_blog
function et_pb_blog($atts)
{
extract(shortcode_atts(array('module_id' => '', 'module_class' => '', 'fullwidth' => 'on', 'posts_number' => 10, 'include_categories' => '', 'meta_date' => 'M j, Y', 'show_thumbnail' => 'on', 'show_content' => 'off', 'show_author' => 'on', 'show_date' => 'on', 'show_categories' => 'on', 'show_pagination' => 'on', 'background_layout' => 'light', 'show_more' => 'off'), $atts));
global $paged;
$container_is_closed = false;
if ('on' !== $fullwidth) {
wp_enqueue_script('jquery-masonry-3');
}
$args = array('posts_per_page' => (int) $posts_number);
$et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
if (is_front_page()) {
$paged = $et_paged;
}
if ('' !== $include_categories) {
$args['cat'] = $include_categories;
}
if (!is_search()) {
$args['paged'] = $et_paged;
}
ob_start();
query_posts($args);
if (have_posts()) {
while (have_posts()) {
the_post();
$post_format = get_post_format();
$thumb = '';
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters('et_pb_blog_image_width', $width);
$height = 'on' === $fullwidth ? 675 : 250;
$height = (int) apply_filters('et_pb_blog_image_height', $height);
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
$no_thumb_class = '' === $thumb || 'off' === $show_thumbnail ? ' et_pb_no_thumb' : '';
if (in_array($post_format, array('video', 'gallery'))) {
$no_thumb_class = '';
}
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class('et_pb_post' . $no_thumb_class);
?>
>
<?php
et_divi_post_format_content();
if (!in_array($post_format, array('link', 'audio', 'quote'))) {
if ('video' === $post_format && false !== ($first_video = et_get_first_video())) {
printf('<div class="et_main_video_container">
%1$s
</div>', $first_video);
} elseif ('gallery' === $post_format) {
et_gallery_images();
} elseif ('' !== $thumb && 'on' === $show_thumbnail) {
if ('on' !== $fullwidth) {
echo '<div class="et_pb_image_container">';
}
?>
<a href="<?php
the_permalink();
?>
">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
?>
</a>
<?php
if ('on' !== $fullwidth) {
echo '</div> <!-- .et_pb_image_container -->';
}
}
}
?>
<div class="article_info">
<?php
if ('off' === $fullwidth || !in_array($post_format, array('link', 'audio', 'quote', 'gallery'))) {
?>
<?php
if (!in_array($post_format, array('link', 'audio'))) {
?>
<p class="post-meta"><?php
echo get_the_date($meta_date);
?>
</p>
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
}
?>
//.........这里部分代码省略.........
示例2: the_title
<h1><?php
the_title();
?>
</h1>
<?php
et_divi_post_meta();
$thumb = '';
$width = (int) apply_filters('et_pb_index_blog_image_width', 1080);
$height = (int) apply_filters('et_pb_index_blog_image_height', 675);
$classtext = 'et_featured_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
$post_format = get_post_format();
if ('video' === $post_format && false !== ($first_video = et_get_first_video())) {
printf('<div class="et_main_video_container">
%1$s
</div>', $first_video);
} else {
if (!in_array($post_format, array('gallery', 'link', 'quote')) && 'on' === et_get_option('divi_thumbnails', 'on') && '' !== $thumb) {
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
} else {
if ('gallery' === $post_format) {
et_gallery_images();
}
}
}
?>
<?php
示例3:
?>
>
<?php
if ('' != get_the_post_thumbnail() || 'video' === get_post_format()) {
?>
<div class="main-image<?php
if ('' == get_the_post_thumbnail() && 'video' === get_post_format()) {
echo ' et_video_only';
}
?>
">
<?php
if ('video' === get_post_format() && false !== ($first_video = et_get_first_video())) {
?>
<div class="et-video-container">
<?php
echo $first_video;
?>
</div>
<?php
}
?>
<?php
if (!is_single() || !'video' !== get_post_format()) {
?>
<a href="<?php
the_permalink();
示例4: shortcode_callback
function shortcode_callback($atts, $content = null, $function_name)
{
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$fullwidth = $this->shortcode_atts['fullwidth'];
$posts_number = $this->shortcode_atts['posts_number'];
$include_categories = $this->shortcode_atts['include_categories'];
$meta_date = $this->shortcode_atts['meta_date'];
$show_thumbnail = $this->shortcode_atts['show_thumbnail'];
$show_content = $this->shortcode_atts['show_content'];
$show_author = $this->shortcode_atts['show_author'];
$show_date = $this->shortcode_atts['show_date'];
$show_categories = $this->shortcode_atts['show_categories'];
$show_comments = $this->shortcode_atts['show_comments'];
$show_pagination = $this->shortcode_atts['show_pagination'];
$background_layout = $this->shortcode_atts['background_layout'];
$show_more = $this->shortcode_atts['show_more'];
$offset_number = $this->shortcode_atts['offset_number'];
$masonry_tile_background_color = $this->shortcode_atts['masonry_tile_background_color'];
$use_dropshadow = $this->shortcode_atts['use_dropshadow'];
global $paged;
$module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
$container_is_closed = false;
if ('' !== $masonry_tile_background_color) {
ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_blog_grid .et_pb_post', 'declaration' => sprintf('background-color: %1$s;', esc_html($masonry_tile_background_color))));
}
if ('on' !== $fullwidth) {
if ('on' === $use_dropshadow) {
$module_class .= ' et_pb_blog_grid_dropshadow';
}
wp_enqueue_script('salvattore');
$background_layout = 'light';
}
$args = array('posts_per_page' => (int) $posts_number);
$et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
if (is_front_page()) {
$paged = $et_paged;
}
if ('' !== $include_categories) {
$args['cat'] = $include_categories;
}
if (!is_search()) {
$args['paged'] = $et_paged;
}
if ('' !== $offset_number && !empty($offset_number)) {
/**
* Offset + pagination don't play well. Manual offset calculation required
* @see: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
*/
if ($paged > 1) {
$args['offset'] = ($et_paged - 1) * intval($posts_number) + intval($offset_number);
} else {
$args['offset'] = intval($offset_number);
}
}
if (is_single() && !isset($args['post__not_in'])) {
$args['post__not_in'] = array(get_the_ID());
}
ob_start();
query_posts($args);
if (have_posts()) {
while (have_posts()) {
the_post();
$post_format = et_pb_post_format();
$thumb = '';
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters('et_pb_blog_image_width', $width);
$height = 'on' === $fullwidth ? 675 : 250;
$height = (int) apply_filters('et_pb_blog_image_height', $height);
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
$no_thumb_class = '' === $thumb || 'off' === $show_thumbnail ? ' et_pb_no_thumb' : '';
if (in_array($post_format, array('video', 'gallery'))) {
$no_thumb_class = '';
}
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class('et_pb_post' . $no_thumb_class);
?>
>
<?php
et_divi_post_format_content();
if (!in_array($post_format, array('link', 'audio', 'quote'))) {
if ('video' === $post_format && false !== ($first_video = et_get_first_video())) {
printf('<div class="et_main_video_container">
%1$s
</div>', $first_video);
} elseif ('gallery' === $post_format) {
et_gallery_images();
} elseif ('' !== $thumb && 'on' === $show_thumbnail) {
if ('on' !== $fullwidth) {
echo '<div class="et_pb_image_container">';
}
//.........这里部分代码省略.........
示例5: shortcode_callback
//.........这里部分代码省略.........
}
ob_start();
query_posts($args);
if (have_posts()) {
while (have_posts()) {
the_post();
$post_format = et_pb_post_format();
$thumb = '';
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters('et_pb_blog_image_width', $width);
$height = 'on' === $fullwidth ? 675 : 250;
$height = (int) apply_filters('et_pb_blog_image_height', $height);
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
$no_thumb_class = '' === $thumb || 'off' === $show_thumbnail ? ' et_pb_no_thumb' : '';
if (in_array($post_format, array('video', 'gallery'))) {
$no_thumb_class = '';
}
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class('et_pb_post clearfix' . $no_thumb_class . $overlay_class);
?>
>
<?php
et_divi_post_format_content();
if (!in_array($post_format, array('link', 'audio', 'quote'))) {
if ('video' === $post_format && false !== ($first_video = et_get_first_video())) {
printf('<div class="et_main_video_container">
%1$s
</div>', $first_video);
} elseif ('gallery' === $post_format) {
et_pb_gallery_images('slider');
} elseif ('' !== $thumb && 'on' === $show_thumbnail) {
if ('on' !== $fullwidth) {
echo '<div class="et_pb_image_container">';
}
?>
<a href="<?php
esc_url(the_permalink());
?>
" class="entry-featured-image-url">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
?>
<?php
if ('on' === $use_overlay) {
echo $overlay_output;
}
?>
</a>
<?php
if ('on' !== $fullwidth) {
echo '</div> <!-- .et_pb_image_container -->';
}
}
}
?>
<?php
示例6: shortcode_callback
//.........这里部分代码省略.........
$thumb = '';
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters('et_pb_blog_image_width', $width);
$height = 'on' === $fullwidth ? 675 : 250;
$height = (int) apply_filters('et_pb_blog_image_height', $height);
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
$no_thumb_class = '' === $thumb || 'off' === $show_thumbnail ? ' et_pb_no_thumb' : '';
if (in_array($post_format, array('video', 'gallery'))) {
$no_thumb_class = '';
}
?>
<article onclick="location.href='<?php
the_permalink();
?>
';" style="cursor:pointer;" id="post-<?php
the_ID();
?>
" class="new-post <?php
$cat_color = get_the_category();
echo $cat_color[1]->slug;
echo ' ';
?>
"<?php
post_class('et_pb_post' . $no_thumb_class);
?>
>
<?php
et_divi_post_format_content();
if (!in_array($post_format, array('link', 'audio', 'quote'))) {
if ('video' === $post_format && false !== ($first_video = et_get_first_video())) {
printf('<div class="et_main_video_container">
%1$s
</div>', $first_video);
} elseif ('gallery' === $post_format) {
et_pb_gallery_images('slider');
} elseif ('' !== $thumb && 'on' === $show_thumbnail) {
if ('on' !== $fullwidth) {
echo '<div class="et_pb_image_container">';
}
?>
<a href="<?php
the_permalink();
?>
">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
?>
</a>
<?php
if ('on' !== $fullwidth) {
echo '</div> <!-- .et_pb_image_container -->';
}
}
}
?>
<?php
if ('off' === $fullwidth || !in_array($post_format, array('link', 'audio', 'quote'))) {
?>
<?php
if (!in_array($post_format, array('link', 'audio'))) {
?>
示例7: et_delete_post_first_video
function et_delete_post_first_video($content)
{
if ('video' === et_pb_post_format() && false !== ($first_video = et_get_first_video())) {
preg_match_all('|^\\s*https?:\\/\\/[^\\s"]+\\s*|im', $content, $urls);
if (!empty($urls[0])) {
$content = str_replace($urls[0], '', $content);
}
}
return $content;
}