function widget($args, $instance) { global $post; extract($args); // only useful on post pages if (!is_single()) { return; } $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags ', 'largo') : $instance['title'], $instance, $this->id_base); echo $before_widget; ?> <!-- Post tags --> <?php if (largo_has_categories_or_tags()) { ?> <div class="tags clearfix"> <h5><?php echo $title; ?> </h5> <ul> <?php largo_categories_and_tags($instance['tag_limit'], true, true, false, '', 'li'); ?> </ul> </div> <?php } echo $after_widget; }
function largo_seo() { // noindex for date archives (and optionally on all archive pages) // if the blog is set to private wordpress already adds noindex,nofollow if (get_option('blog_public')) { if (is_date() || is_archive() && of_get_option('noindex_archives')) { echo '<meta name="robots" content="noindex,follow" />'; } } // single posts get a bunch of other google news specific meta tags if (is_single()) { if (have_posts()) { the_post(); $permalink = get_permalink(); // use categories and tags for the news_keywords meta tag // up to 10 terms per Google guidelines: // https://support.google.com/news/publisher/answer/68297 if (largo_has_categories_or_tags()) { echo '<meta name="news_keywords" content="'; largo_categories_and_tags(10, true, false, false, ', '); echo '">'; } // set the original-source meta tag // see: http://googlenewsblog.blogspot.com/2010/11/credit-where-credit-is-due.html echo '<meta name="original-source" content="' . esc_url($permalink) . '" />'; // check for the existence of a custom field 'permalink' // if it doesn't exist we'll just use the current url as the syndication source if (get_post_meta(get_the_ID(), 'permalink', true)) { echo '<meta name="syndication-source" content="' . get_post_meta(get_the_ID(), 'permalink', true) . '" />'; } else { echo '<meta name="syndication-source" content="' . esc_url($permalink) . '" />'; } // add the standout metatag if this post is flagged with any of the terms in the prominence taxonomy // see: https://support.google.com/news/publisher/answer/191283 if (has_term(get_terms('prominence', array('fields' => 'names')), 'prominence')) { echo '<meta name="standout" content="' . esc_url($permalink) . '"/>'; } } } rewind_posts(); }
the_post_thumbnail(); ?> </a> </div> <?php } ?> <?php if (isset($opt['show']['excerpt']) && $opt['show']['excerpt']) { largo_excerpt($post, 5, true, __('Continue Reading →', 'largo'), true, false); } ?> <?php if (isset($opt['show']['tags']) && $opt['show']['tags'] && largo_has_categories_or_tags() && $tags === 'btm') { ?> <h5 class="tag-list"><strong><?php _e('Filed under:', 'largo'); ?> </strong> <?php largo_categories_and_tags(8); ?> </h5> <?php } ?> </div><!-- .entry-content --> </article><!-- #post-<?php
the_title(); ?> </a> </h2> <h5 class="byline"><?php largo_byline(); ?> </h5> <?php largo_excerpt($post, 5, true, __('Continue Reading', 'largo'), true, false); ?> <?php if (!is_home() && largo_has_categories_or_tags() && $tags === 'btm') { ?> <h5 class="tag-list"><strong><?php _e('More about:', 'largo'); ?> </strong> <?php largo_categories_and_tags(8); ?> </h5> <?php } ?> </div><!-- .entry-content --> </article><!-- #post-<?php
<?php // 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()) { ?> <h5 class="top-tag"><?php echo largo_top_term($top_term_args); ?> </h5> <?php } // 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"; ?> <a href="<?php echo get_permalink(); ?> "><?php echo get_the_post_thumbnail(get_the_ID(), '60x60', $img_attr); ?> </a> <?php } elseif ($thumb == 'medium') { $img_location = $instance['image_align'] != '' ? $instance['image_align'] : 'left'; $img_attr = array('class' => $img_location . '-align'); $img_attr['class'] .= " attachment-thumbnail"; ?>
$showposts = 6; $showposts = apply_filters('largo_homepage_topstories_post_count', $showposts); $substories = largo_get_featured_posts(array('tax_query' => array(array('taxonomy' => 'prominence', 'field' => 'slug', 'terms' => 'homepage-featured')), 'showposts' => $showposts, 'post__not_in' => $shown_ids)); if ($substories->have_posts()) { $count = 1; while ($substories->have_posts()) { $substories->the_post(); $shown_ids[] = get_the_ID(); if ($count <= 3) { ?> <div <?php post_class('story'); ?> > <?php if (largo_has_categories_or_tags() && $tags === 'top') { ?> <h5 class="top-tag"><?php largo_top_term(); ?> </h5> <?php } ?> <h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3>
/** * 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; }