Example #1
0
    $fb_url = build_query(array('u' => get_short_url($post->ID)));
    ?>
									<a rel="nofollow" href="https://www.facebook.com/sharer/sharer.php?<?php 
    echo $fb_url;
    ?>
" title="Share this on Facebook" target="_blank" class="btn-facebook"><span class="sss_fb_button icon-facebook"></span>Share</a>
								</div>
								<p class="description">Saat share Facebook gunakanlah <span>#l<?php 
    echo $post->ID;
    ?>
</span> untuk memperkuat pendapat Anda</p>
							</div>
							<div class="widget-box widget-popular">
								<h4>Isu Terpopuler</h4>
								<?php 
    $popular = get_popular_posts(5);
    ?>
								<ul class="widget-list">
									<?php 
    if (!empty($popular)) {
        foreach ($popular as $key => $popular) {
            ?>
									<li>
										<div class="row">
											<div class="img-box col-md-4">
												<?php 
            echo get_the_post_thumbnail($popular->ID, 'medium');
            ?>
											</div>
											<div class="list-content col-md-8">
												<a href=""><?php 
Example #2
0
    echo '<li><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"] . '</a> </li> ';
}
?>
	  </div>
	</div>
</div><!-- col-md-6 -->

<div class="col-md-6">
	<!-- hotest articles -->
	<div class="padding-top40"></div>
	<div class="panel panel-info">
	  <div class="panel-heading">
	    <h3 class="panel-title"><?php 
echo __("热门文章", "hua");
?>
<a class="panel-title-right" href="#">更多>></a></h3>
	  </div>
	  <div class="panel-body">
	  <?php 
echo get_popular_posts(10);
?>
	  </div>
	</div>
</div><!-- col-md-6 -->

</div><!-- row -->
<div class="margin-top80"></div>
</div><!-- container -->

<?php 
get_footer();
/**
 *
 * Function to generate the popular post list
 *
 **/
function dp_print_popular_posts($show_num, $thumb_width, $word_limit)
{
    global $post;
    $popular_posts = get_popular_posts($show_num);
    if ($popular_posts->have_posts()) {
        while ($popular_posts->have_posts()) {
            $popular_posts->the_post();
            $output = "<div class='recent-post-widget'>";
            $thumbnail_id = get_post_thumbnail_id($post->ID);
            $thumbnail = wp_get_attachment_image_src($thumbnail_id);
            $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
            if (!empty($thumbnail)) {
                $output .= '<div class="thumbnail">';
                $output .= '<a href="' . get_permalink($post->ID) . '">';
                $output .= '<img class="pic2" width="' . $thumb_width . '" src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>';
                $output .= '</a></div>';
            }
            $output .= '<div class="content">';
            $output .= '<div class="excerpt"><a href="' . get_permalink($post->ID) . '">';
            $excerpt = preg_replace('/<img[^>]+./', '', get_the_content());
            $output .= string_limit_words($excerpt, $word_limit) . '&hellip;</a></div>';
            $output .= '<div class="date">';
            $output .= mysql2date('j M Y', $post->post_date);
            $output .= '</div>';
            $output .= '</div>';
            $output .= '<div class="clearboth"></div>';
            $output .= "</div>";
        }
    }
    return $output;
}