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']); ?> <p><?php echo et_extra_display_post_meta($meta_args); ?> </p> </div> <div class="excerpt"> <p><?php if ('excerpt' == $blog_feed_page_options['content_length']) { if (has_excerpt()) { the_excerpt(); } else { if (in_array($post_format, array('audio', 'map'))) { $excerpt_length = '100'; } else { $excerpt_length = get_post_thumbnail_id() ? '100' : '230'; } et_truncate_post($excerpt_length);
} ?> <div class="post-content"> <h3><a href="<?php the_permalink(); ?> " data-hover-color="<?php echo esc_attr($color); ?> "><?php the_title(); ?> </a></h3> <div class="post-meta"> <p><?php echo et_extra_display_post_meta(array('author_link' => $show_author, 'post_date' => $show_date, 'date_format' => $date_format, 'categories' => $show_categories, 'comment_count' => $show_comments, 'rating_stars' => $show_rating)); ?> </p> </div> </div> </article> </li> <?php } } ?> </ul> <?php wp_reset_postdata(); } else {
" <?php post_class('module single-project-module'); ?> > <?php if (is_post_extra_title_meta_enabled()) { ?> <div class="post-header"> <h1><?php the_title(); ?> </h1> <div class="post-meta"> <p> <?php echo et_extra_display_post_meta(array('rating_stars' => false)); ?> </p> </div> </div> <?php } ?> <?php $attachments = extra_get_the_project_gallery_images(); $thumbnail_id = get_post_thumbnail_id(); if ($attachments) { ?> <?php $gallery_autoplay = get_post_meta(get_the_ID(), '_gallery_autoplay', true);
function extra_display_single_post_meta() { $post_meta_options = et_get_option('extra_postinfo2', array('author', 'date', 'categories', 'comments', 'rating_stars')); $meta_args = array('author_link' => in_array('author', $post_meta_options), 'author_link_by' => __('Posted by %s', 'extra'), 'post_date' => in_array('date', $post_meta_options), 'categories' => in_array('categories', $post_meta_options), 'comment_count' => in_array('comments', $post_meta_options), 'rating_stars' => in_array('rating_stars', $post_meta_options)); return et_extra_display_post_meta($meta_args); }
function widget($args, $instance) { $cache = array(); if (!$this->is_preview()) { $cache = wp_cache_get('widget_recent_posts', '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(); $title = !empty($instance['title']) ? $instance['title'] : __('Recent Posts', '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; } $show_date = isset($instance['show_date']) ? $instance['show_date'] : false; $show_thumb = isset($instance['show_thumb']) ? $instance['show_thumb'] : false; $show_categories = isset($instance['show_categories']) ? $instance['show_categories'] : false; /** * Filter the arguments for the Recent Posts widget. * * @since 3.4.0 * * @see WP_Query::get_posts() * * @param array $args An array of arguments used to retrieve the recent posts. */ $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($r->have_posts()) { ?> <?php echo $args['before_widget']; ?> <?php if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="widget_list"> <?php while ($r->have_posts()) { $r->the_post(); ?> <li> <?php $color = extra_get_post_category_color(); $post_format = et_get_post_format(); if ($show_thumb) { if (in_array($post_format, array('video', 'quote', 'link', 'audio', 'map', 'text'))) { $thumb_src = et_get_post_format_thumb($post_format); $img_style = sprintf('background-color:%s', $color); } else { if ('gallery' == $post_format) { $thumb_src = et_get_gallery_post_format_thumb(); } else { if (!get_post_thumbnail_id()) { $thumb_src = et_get_post_format_thumb('text', 'icon'); $img_style = sprintf('background-color:%s', $color); } } } $thumb_args = array('a_class' => array('widget_list_thumbnail'), 'size' => 'extra-image-square-small', 'thumb_src' => !empty($thumb_src) ? $thumb_src : '', 'img_style' => !empty($img_style) ? $img_style : ''); ?> <?php echo et_extra_get_post_thumb($thumb_args); ?> <?php } ?> <div class="post_info"> <a href="<?php the_permalink(); ?> " class="title"><?php get_the_title() ? the_title() : the_ID(); ?> </a> <?php $meta_args = array('post_date' => $show_date, 'categories' => $show_categories, 'author_link' => false, 'comment_count' => false, 'rating_stars' => false); ?> <div class="post-meta"> <?php echo et_extra_display_post_meta($meta_args); ?> </div> </div> </li> <?php } ?> <?php wp_reset_postdata(); ?> </ul> <?php echo $args['after_widget']; // 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_posts', $cache, 'extra'); } else { ob_end_flush(); } }
function mega_item_featured_3($item, $args, $posts) { $output = '<ul class="sub-menu" style="' . esc_attr($this->get_mega_item_border_top($item)) . '">'; $post_count = 0; foreach ($posts->posts as $post) { if ($post_count >= 3) { break; } $thumb = et_extra_get_post_thumb(array('post_id' => $post->ID, 'size' => 'extra-image-small', 'a_class' => array('featured-image'))); $output .= sprintf(' <li> <h2 class="title">%1$s</h2> <div class="featured-post"> %2$s <h2>%3$s</h2> <div class="post-meta"> %4$s </div> </div> </li>', esc_html__('Featured', 'extra'), $thumb, esc_html($post->post_title), et_extra_display_post_meta(array('post_id' => $post->ID, 'comment_count' => false, 'author_link' => false))); $post_count++; } $output .= '</ul>'; return $output; }