Ejemplo n.º 1
0
    /**
     * Outputs the widget based on the arguments input through the widget controls.
     *
     * @since  1.0.0
     * @access public
     * @param  array  $sidebar
     * @param  array  $instance
     * @return void
     */
    function widget($sidebar, $instance)
    {
        /* Set the $args for wp_get_archives() to the $instance array. */
        $args = wp_parse_args($instance, $this->defaults);
        /* Output the sidebar's $before_widget wrapper. */
        echo $sidebar['before_widget'];
        /* If a title was input by the user, display it. */
        if (!empty($args['title'])) {
            echo $sidebar['before_title'] . apply_filters('widget_title', $args['title'], $instance, $this->id_base) . $sidebar['after_title'];
        }
        /* Query the most/least viewed posts. */
        $loop = new WP_Query(array('post_type' => $args['post_type'], 'posts_per_page' => $args['posts_per_page'], 'order' => $args['order'], 'orderby' => 'meta_value_num', 'ignore_sticky_posts' => true, 'meta_key' => ev_get_meta_key()));
        if ($loop->have_posts()) {
            ?>

			<ul class="ev-entry-views-list">

				<?php 
            while ($loop->have_posts()) {
                $loop->the_post();
                ?>

					<li>
						<?php 
                the_title('<a href="' . get_permalink() . '">', '</a>');
                ?>
 
						<?php 
                if (true == $args['show_view_count']) {
                    ?>
							<?php 
                    ev_post_views(array('text' => '(%s)', 'wrap' => '<span class="entry-view-count">%2$s</span>'));
                    ?>
						<?php 
                }
                ?>
					</li>

				<?php 
            }
            ?>

			</ul><!-- .ev-entry-views-list -->

		<?php 
        }
        /* Close the sidebar's widget wrapper. */
        echo $sidebar['after_widget'];
    }
Ejemplo n.º 2
0
    the_author_posts_link();
    ?>
</span>
				<time <?php 
    hybrid_attr('entry-published');
    ?>
><?php 
    echo get_the_date();
    ?>
</time>
				<?php 
    comments_popup_link(number_format_i18n(0), number_format_i18n(1), '%', 'comments-link', '');
    ?>
				<?php 
    if (function_exists('ev_post_views')) {
        ev_post_views(array('text' => '%s'));
    }
    ?>
				<?php 
    edit_post_link();
    ?>
			</div><!-- .entry-byline -->

		</header><!-- .entry-header -->

		<div <?php 
    hybrid_attr('entry-content');
    ?>
>
			<?php 
    the_content();