function extra_get_the_post_score_bar($args = array()) { $default_args = array('post_id' => 0); $args = wp_parse_args($args, $default_args); $post_id = $args['post_id'] ? $args['post_id'] : get_the_ID(); $color = extra_get_post_category_color($post_id); $breakdown_score = get_post_meta($post_id, '_post_review_box_breakdowns_score', true); if (false === extra_post_review()) { return; } $bar = sprintf('<span class="score-bar" style="width:%1$d%%;background-color:%2$s;"><span class="score-text">%3$s</span></span>', esc_attr(max(9, intval($breakdown_score))), esc_attr($color), sprintf(esc_html__('Score %1$d%%', 'extra'), intval($breakdown_score))); return $bar; }
" <?php post_class('hentry ' . $post_format_class); ?> > <div class="header"> <?php $thumb_args = array('size' => 'extra-image-medium', 'img_after' => '<span class="et_pb_extra_overlay"></span>'); require locate_template('post-top-content.php'); ?> </div> <?php if (!in_array($post_format, array('quote', 'link'))) { ?> <div class="post-content"> <?php $color = extra_get_post_category_color(); ?> <h2 class="post-title"><a class="et-accent-color" style="color:<?php echo esc_attr($color); ?> ;" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="post-meta"> <p><?php echo extra_display_archive_post_meta(); ?>
post_class('et-format-' . $post_format); ?> > <div class="header"> <?php $thumb_args = array('size' => 'extra-image-medium', 'img_after' => '<span class="et_pb_extra_overlay"></span>'); $score_bar = extra_get_the_post_score_bar(); require locate_template('post-top-content.php'); ?> </div> <?php if (!in_array($post_format, array('quote', 'link'))) { ?> <div class="post-content"> <?php $color = !empty($category_color) ? $category_color : extra_get_post_category_color(); ?> <h2 class="post-title"><a class="et-accent-color" style="color:<?php echo esc_attr($color); ?> ;" href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <div class="post-meta"> <?php $meta_args = array('author_link' => $blog_feed_page_options['show_author'], 'post_date' => $blog_feed_page_options['show_date'], 'date_format' => $blog_feed_page_options['date_format'], 'categories' => $blog_feed_page_options['show_categories']);
function widget($args, $instance) { $cache = array(); if (!$this->is_preview()) { $cache = wp_cache_get('widget_recent_videos', 'extra'); } if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = !empty($instance['title']) ? $instance['title'] : __('Recent Videos', 'extra'); /** This filter is documented in wp-includes/default-widgets.php */ $title = apply_filters('widget_title', $title, $instance, $this->id_base); $number = !empty($instance['number']) ? absint($instance['number']) : 5; if (!$number) { $number = 5; } $recent_video_posts = new WP_Query(apply_filters('widget_recent_videos_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'tax_query' => array(array('taxonomy' => ET_POST_FORMAT, 'field' => 'slug', 'terms' => ET_POST_FORMAT_PREFIX . 'video'))))); if ($recent_video_posts->have_posts()) { ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <div class="widget_video_wrapper"> <img src="<?php echo esc_url(get_template_directory_uri()); ?> /images/pagination-loading.gif" alt="<?php _e('Loading...', 'extra'); ?> " class="widget_video_loading"> </div><!-- .widget_video_wrapper --> <div class="widget_content"> <?php while ($recent_video_posts->have_posts()) { $recent_video_posts->the_post(); ?> <script type="text/template" class="widget-video-item widget-video-item-<?php echo esc_attr(get_the_ID()); ?> "> <?php $video_urls = get_post_meta(get_the_ID(), '_video_format_urls', true); if (!empty($video_urls)) { $video_embed = extra_get_video_embed($video_urls); echo $video_embed; // Display cover image if (has_post_thumbnail() && $video_embed) { $thumbnail_id = get_post_thumbnail_id(); $thumbnail_src = wp_get_attachment_image_src($thumbnail_id, extra_get_column_thumbnail_size()); if (isset($thumbnail_src[0])) { ?> <div class="video-overlay" style="background-image: url(<?php esc_attr_e($thumbnail_src[0]); ?> );"> <div class="video-overlay-hover"> <a href="#" class="video-play-button"></a> </div> </div> <?php } } } ?> </script><!-- .widget-video-item --> <?php } ?> <script type="text/template" class="widget-video-item widget-video-item-empty"> <h4 class="no-video-title"><?php _e('No Video Found'); ?> </h4> </script> </div><!-- .widget_content --> <?php $recent_video_posts->rewind_posts(); ?> <ul class="widget_list"> <?php while ($recent_video_posts->have_posts()) { $recent_video_posts->the_post(); ?> <li> <?php $color = extra_get_post_category_color(); $post_format = et_get_post_format(); ?> <a href="<?php the_permalink(); ?> " data-video-id="<?php echo esc_attr(get_the_ID()); ?> " class="title"><?php get_the_title() ? the_title() : the_ID(); ?> </a> </li> <?php } ?> <?php wp_reset_postdata(); ?> </ul> <?php echo $after_widget; ?> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } if (!$this->is_preview()) { $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('et_widget_recent_videos', $cache, 'extra'); } else { ob_end_flush(); } }