function widget($args, $instance) { global $post; // Preserve global $post $preserve = $post; extract($args); // only useful on post pages if (!is_single()) { return; } $title = apply_filters('widget_title', empty($instance['title']) ? __('Read Next', 'largo') : $instance['title'], $instance, $this->id_base); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $related = new Largo_Related($instance['qty']); //get the related posts $rel_posts = new WP_Query(array('post__in' => $related->ids(), 'nopaging' => 1, 'posts_per_page' => $instance['qty'], 'ignore_sticky_posts' => 1)); if ($rel_posts->have_posts()) { echo '<ul class="related">'; while ($rel_posts->have_posts()) { $rel_posts->the_post(); echo '<li>'; echo '<a href="' . get_permalink() . '"/>' . get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'alignleft')) . '</a>'; ?> <h4><a href="<?php the_permalink(); ?> " title="Read: <?php esc_attr(the_title('', '', FALSE)); ?> "><?php the_title(); ?> </a></h4> <h5 class="byline"> <span class="by-author"><?php largo_byline(true, true); ?> </span> <time class="entry-date updated dtstamp pubdate" datetime="<?php echo esc_attr(get_the_date('c')); ?> "><?php largo_time(); ?> </time> </h5> <?php // post excerpt/summary largo_excerpt(get_the_ID(), 2, false, '', true); echo '</li>'; } echo "</ul>"; } echo $after_widget; // Restore global $post wp_reset_postdata(); $post = $preserve; }
/** * Returns markup for the headline of the top story **/ function homepage_big_story_headline($moreLink = false) { $bigStoryPost = largo_home_single_top(); ob_start(); ?> <article> <h5 class="top-tag"><?php largo_top_term(array('post' => $bigStoryPost->ID)); ?> </h5> <h2><a href="<?php echo get_permalink($bigStoryPost->ID); ?> "><?php echo $bigStoryPost->post_title; ?> </a></h2> <h5 class="byline"><?php largo_byline(true, true, $bigStoryPost); ?> </h5> <section> <?php if (empty($moreLink)) { largo_excerpt($bigStoryPost, 2, false); } else { largo_excerpt($bigStoryPost, 2, true, __('Continue Reading →', 'largo'), true, false); } ?> </section> </article> <?php wp_reset_postdata(); $ret = ob_get_contents(); ob_end_clean(); return $ret; }
the_post_thumbnail('large'); ?> </a> <?php } ?> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <h5 class="byline"><?php largo_byline(); ?> </h5> <?php largo_excerpt($post, 4, false); ?> <?php if (largo_post_in_series()) { $feature = largo_get_the_main_feature(); $feature_posts = largo_get_recent_posts_for_term($feature, 1, 1); if ($feature_posts) { foreach ($feature_posts as $feature_post) { ?> <h4 class="related-story"> <?php _e('RELATED:', 'largo');
} // #content span width helper $content_span = array('one-column' => 12, 'two-column' => 8, 'three-column' => 5); ?> <?php if ($opt['header_enabled']) { ?> <section id="series-header" class="span12"> <h1 class="entry-title"><?php the_title(); ?> </h1> <?php if ($opt['show_series_byline']) { echo '<h5 class="byline">' . largo_byline(false) . '</h5>'; } if ($opt['show_sharebar']) { largo_post_social_links(); } ?> <div class="description"> <?php echo apply_filters('the_content', $post->post_excerpt); ?> </div> <?php if ('standard' == $opt['header_style']) { //need to set a size, make this responsive, etc ?> <div class="full series-banner full-image"><?php
echo get_the_title(); ?> <?php if (isset($instance['show_icon']) && $instance['show_icon'] == true) { post_type_icon(); } ?> </a> </h5> <?php // byline on posts if (isset($instance['show_byline']) && $instance['show_byline'] == true) { ?> <span class="byline"><?php echo largo_byline(false); ?> </span> <?php } // the excerpt if ($excerpt == 'num_sentences') { ?> <p><?php echo largo_trim_sentences(get_the_content(), $instance['num_sentences']); ?> </p> <?php } elseif ($excerpt == 'custom_excerpt') { ?> <p><?php
?> <header> <h2 class="entry-title"> <a href="<?php echo post_permalink($featured_post->ID); ?> " title="<?php echo __('Permalink to', 'largo') . esc_attr(strip_tags($featured_post->post_title)); ?> " rel="bookmark"><?php echo $featured_post->post_title; ?> </a> </h2> <h5 class="byline"><?php largo_byline(true, false, $featured_post); ?> </h5> </header> <div class="entry-content"> <?php largo_excerpt($featured_post, 5, true, '', true, false); ?> </div> </div> </article>
/** * Outputs the content of the recent posts widget. * * @param array $args widget arguments. * @param array $instance saved values from databse. */ function widget($args, $instance) { global $post, $shown_ids; // an array of post IDs already on a page so we can avoid duplicating posts; // Preserve global $post $preserve = $post; extract($args); $posts_term = of_get_option('posts_term_plural', 'Posts'); // Add the link to the title. $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent ' . $posts_term, 'largo') : $instance['title'], $instance, $this->id_base); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $thumb = isset($instance['thumbnail_display']) ? $instance['thumbnail_display'] : 'small'; $excerpt = isset($instance['excerpt_display']) ? $instance['excerpt_display'] : 'num_sentences'; $query_args = array('post__not_in' => get_option('sticky_posts'), 'showposts' => $instance['num_posts'], 'post_status' => 'publish'); if (isset($instance['avoid_duplicates']) && $instance['avoid_duplicates'] === 1) { $query_args['post__not_in'] = $shown_ids; } if ($instance['cat'] != '') { $query_args['cat'] = $instance['cat']; } if ($instance['tag'] != '') { $query_args['tag'] = $instance['tag']; } if ($instance['author'] != '') { $query_args['author'] = $instance['author']; } if ($instance['taxonomy'] != '') { $query_args['tax_query'] = array(array('taxonomy' => $instance['taxonomy'], 'field' => 'slug', 'terms' => $instance['term'])); } echo '<ul>'; $my_query = new WP_Query($query_args); if ($my_query->have_posts()) { $output = ''; while ($my_query->have_posts()) { $my_query->the_post(); $shown_ids[] = get_the_ID(); // wrap the items in li's. $output .= '<li>'; // The top term $top_term_args = array('echo' => false); if (isset($instance['show_top_term']) && $instance['show_top_term'] == 1 && largo_has_categories_or_tags()) { $output .= '<h5 class="top-tag">' . largo_top_term($top_term_args) . '</h5>'; } // the thumbnail image (if we're using one) if ($thumb == 'small') { $img_location = $instance['image_align'] != '' ? $instance['image_align'] : 'left'; $img_attr = array('class' => $img_location . '-align'); $img_attr['class'] .= " attachment-small"; $output .= '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), '60x60', $img_attr) . '</a>'; } elseif ($thumb == 'medium') { $img_location = $instance['image_align'] != '' ? $instance['image_align'] : 'left'; $img_attr = array('class' => $img_location . '-align'); $img_attr['class'] .= " attachment-thumbnail"; $output .= '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), 'post-thumbnail', $img_attr) . '</a>'; } elseif ($thumb == 'large') { $img_attr = array(); $img_attr['class'] .= " attachment-large"; $output .= '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), 'large', $img_attr) . '</a>'; } // the headline $output .= '<h5><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>'; // byline on posts if (isset($instance['show_byline']) && $instance['show_byline'] == true) { $output .= '<span class="byline">' . largo_byline(false) . '</span>'; } // the excerpt if ($excerpt == 'num_sentences') { $output .= '<p>' . largo_trim_sentences(get_the_content(), $instance['num_sentences']) . '</p>'; } elseif ($excerpt == 'custom_excerpt') { $output .= '<p>' . get_the_excerpt() . '</p>'; } // read more link if (isset($instance['show_read_more']) && $instance['show_read_more'] === 1) { $output .= '<p class="more-link"><a href="' . get_permalink() . '">' . __('Read More', 'largo') . '</a></p>'; } // close the item $output .= '</li>'; } // print all of the items echo $output; } else { printf(__('<p class="error"><strong>You don\'t have any recent %s.</strong></p>', 'largo'), strtolower($posts_term)); } // end more featured posts // close the ul if we're just showing a list of headlines if ($excerpt == 'none') { echo '</ul>'; } if ($instance['linkurl'] != '') { echo '<p class="morelink"><a href="' . esc_url($instance['linkurl']) . '">' . esc_html($instance['linktext']) . '</a></p>'; } echo $after_widget; // Restore global $post wp_reset_postdata(); $post = $preserve; }