Beispiel #1
0
    function widget($args, $instance)
    {
        extract($args);
        $limit = strip_tags($instance['limit']);
        $limit = $limit ? $limit : 10;
        ?>
		<div class="widget widget-populars">
			<h3><?php 
        _e('Popular posts', MUTHEME_NAME);
        ?>
</h3>
			<ul class="list">
				<?php 
        $args = array('paged' => 1, 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'ignore_sticky_posts' => 1, 'post_type' => 'post', 'post_status' => 'publish', 'showposts' => $limit);
        $posts = query_posts($args);
        ?>
				<?php 
        while (have_posts()) {
            the_post();
            ?>
					<li class="widget-popular">
						<p>
							<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark"
							   title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a>
							<?php 
            if (function_exists('the_views')) {
                ?>
								<span><?php 
                echo mutheme_views_count();
                ?>
</span>
							<?php 
            }
            ?>
						</p>
					</li>
				<?php 
        }
        wp_reset_query();
        $posts = null;
        ?>
			</ul>
		</div>
	<?php 
    }
Beispiel #2
0
/**
 * Post views
 */
function mutheme_views()
{
    if (function_exists('the_views')) {
        global $post;
        ?>
		<li class="inline-li"><span class="post-span">·</span></li>
		<li class="inline-li"><?php 
        echo mutheme_views_count() . __(' views', MUTHEME_NAME);
        ?>
</li>
	<?php 
    }
}