Example #1
0
    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;
    }
Example #2
0
 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();
 }
Example #3
0
		<?php 
}
?>

 		<?php 
if (isset($opt['show']['excerpt']) && $opt['show']['excerpt']) {
    largo_excerpt($post, 5, true, __('Continue&nbsp;Reading&nbsp;&rarr;', '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_ID();
?>
 -->
Example #4
0
/**
 * Returns (and optionally echoes) the 'top term' for a post, falling back to a category if one wasn't specified
 *
 * @param array|string $options Settings for post id, echo, link, use icon, wrapper and exclude
 */
function largo_top_term($options = array())
{
    global $wpdb;
    $defaults = array('post' => get_the_ID(), 'echo' => TRUE, 'link' => TRUE, 'use_icon' => FALSE, 'wrapper' => 'span', 'exclude' => array());
    $args = wp_parse_args($options, $defaults);
    $term_id = get_post_meta($args['post'], 'top_term', TRUE);
    //get the taxonomy slug
    $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM {$wpdb->term_taxonomy} WHERE term_id = %d LIMIT 1", $term_id));
    if (empty($term_id) || empty($taxonomy)) {
        // if no top_term specified, fall back to the first category
        $term_id = get_the_category($args['post']);
        if (!is_array($term_id) || !count($term_id)) {
            return;
        }
        //no categories OR top term? Do nothing
        $term_id = $term_id[0]->term_id;
    }
    if ($term_id) {
        $icon = $args['use_icon'] ? '<i class="icon-white icon-tag"></i>' : '';
        //this will probably change to a callback largo_term_icon() someday
        $link = $args['link'] ? array('<a href="%2$s" title="Read %3$s in the %4$s category">', '</a>') : array('', '');
        // get the term object
        $term = get_term($term_id, $taxonomy);
        if (is_wp_error($term)) {
            return;
        }
        $output = sprintf('<%1$s class="post-category-link">' . $link[0] . '%5$s%4$s' . $link[1] . '</%1$s>', $args['wrapper'], get_term_link($term), of_get_option('posts_term_plural'), $term->name, $icon);
    } else {
        $output = largo_categories_and_tags(1, false, $args['link'], $args['use_icon'], '', $args['wrapper'], $args['exclude']);
        $output = is_array($output) ? $output[0] : '';
    }
    if ($args['echo']) {
        echo $output;
    }
    return $output;
}