function most_viewed()
{
    ob_start();
    $posts = wmp_get_popular(array('limit' => 4, 'post_type' => 'paper', 'range' => 'all_time'));
    global $post;
    if (count($posts) > 0) {
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
		<li><a href="<?php 
            the_permalink();
            ?>
">
			<?php 
            if (get_field('short_title')) {
                the_field('short_title');
            } else {
                the_title();
            }
            ?>
		</a></li>
		<?php 
        }
    }
    wp_reset_query();
    $contents = ob_get_contents();
    ob_end_clean();
    return $contents;
}
예제 #2
0
    public function widget($args, $instance)
    {
        // Find default args
        extract($args);
        // Get our posts
        $defaults = $this->default_options($instance);
        $options['limit'] = (int) $defaults['number'];
        $options['range'] = $defaults['timeline'];
        if ($defaults['post_type'] != 'all') {
            $options['post_type'] = $defaults['post_type'];
        }
        $posts = wmp_get_popular($options);
        // Display the widget
        echo $before_widget;
        if ($defaults['title']) {
            echo $before_title . $defaults['title'] . $after_title;
        }
        echo '<ul>';
        global $post;
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
			<li><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
            ?>
"><?php 
            if (get_the_title()) {
                the_title();
            } else {
                the_ID();
            }
            ?>
</a></li>
			<?php 
        }
        echo '</ul>';
        echo $after_widget;
        // Reset post data
        wp_reset_postdata();
    }
예제 #3
0
    ?>
 		
		<section class="sidebar-block sidebar-block-center">
			<div class="fb-like-box" data-href="http://www.facebook.com/bupipedream" data-width="292" data-height="185" data-show-faces="true" data-border-color="#cccccc" data-stream="false" data-header="false"></div>
		</section>

		<section id="sidebar-twitter" class="sidebar-block sidebar-block-center">
			<a href="https://twitter.com/bupipedream" class="twitter-follow-button" data-show-count="true">Follow @bupipedream</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</section>
		
 		<section id="sidebar-most-read" class="sidebar-block sidebar-article-list sidebar-article-list-small">
			<h1 class="section-heading">Most Read</h1>
			<ol>
				<?php 
    $posts = wmp_get_popular(array('limit' => 5, 'post_type' => 'post', 'range' => 'weekly'));
    global $post;
    if (count($posts) > 0) {
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
					<li>
						<article>
							<h2 class="headline">
								<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
            ?>
">
예제 #4
0
/*
Template Name: Homepage
*/
?>

<?php 
get_header();
?>
			
			<div id="content">	
				<div id="top-post-wrap" class="show-for-large-up">
					<div id="top-post" class="row">
						<ul class="small-block-grid-2 large-block-grid-4">
					<?php 
$posts = wmp_get_popular(array('limit' => 4, 'post_type' => 'post', 'range' => 'all_time'));
// Display the widget
echo $before_widget;
global $post;
foreach ($posts as $post) {
    setup_postdata($post);
    $category = get_the_category($post->ID);
    foreach ($category as $cat) {
        echo '<li class="top-blog-post large-4 medium-4 columns ' . $cat->slug . '">';
        echo '<a href="' . get_permalink($post->ID) . '"></a>';
        echo '<div class="post-icon large-3 hide-for-medium hide-for-small columns"><i title="' . $cat->name . '"></i></div>';
        echo '<div class="columns top-post-text large-9">';
        my_excerpt(13);
        echo '</div>';
        echo '</li>';
    }