예제 #1
0
    function get_LatestPosts($LatestPosts)
    {
        echo '<section class="aside-today">
							<h2 class="aside-today__title">最近更新<span>+' . $LatestPosts . '</span></h2>
							<ul class="aside-today__list"> ';
        ?>
	<?php 
        query_posts('showposts=' . $LatestPosts);
        ?>
	<?php 
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
	<li>
			<div class="topic"><span><a href="<?php 
                the_permalink();
                ?>
"><img style="margin-bottom: 5px;" alt="<?php 
                the_title();
                ?>
"  src="<?php 
                echo mmimg(get_the_ID());
                ?>
" ></a><?php 
                $category = get_the_category();
                if ($category[0]) {
                    echo '<a class="' . random_color() . '"  href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '</a> / ';
                    echo $category[0]->slug;
                }
                ?>
</span></div>
			<h1><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h1>
	</li>
	<?php 
            }
        }
        wp_reset_query();
        echo '							
							</ul>
			</section>';
    }
예제 #2
0
    function get_HotPosts($HotPosts)
    {
        ?>
	<section class="sidebar-popular cf">
				<h3>热门文章</h3>
                <?php 
        $query_data = array('posts_per_page' => $HotPosts, 'orderby' => 'comment_count');
        $post_list = new WP_Query($query_data);
        ?>
				<div class="sidebar-popular__list">
				<?php 
        while ($post_list->have_posts()) {
            $post_list->the_post();
            global $post;
            ?>
                <article class="sidebar-popular__posts cf">
                    <div class="meta"></div>
                    <div class="image thumb-60 left"><img  class='image lazyload' src="http://static.mywpku.com/blank.gif" data-src="<?php 
            echo mmimg(get_the_ID());
            ?>
" alt="<?php 
            the_title();
            ?>
"></div>
                    <h1><a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
"><?php 
            the_title();
            ?>
</a></h1>
                </article>
				<?php 
        }
        ?>
				</div>
                <?php 
        wp_reset_query();
        ?>
	</section>
<?php 
    }
예제 #3
0
            ?>
      <li class="listimg"> <span class="txt"><?php 
            echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 70, "...");
            ?>
        <p><a href="<?php 
            the_permalink();
            ?>
" target="_blank" title="点击查看">点击查看</a></p>
        </span> <a href="<?php 
            the_permalink();
            ?>
" target="_blank" class="lista" title="<?php 
            the_title_attribute();
            ?>
"> <img class="lista" alt="img" src="<?php 
            echo mmimg(get_the_ID());
            ?>
" style="opacity: 1;"></a> </li>
      <?php 
        }
    } else {
        echo '<li>* 暂无相关文章</li>';
    }
    wp_reset_query();
} else {
    echo '<li>* 暂无相关文章</li>';
}
?>
    </ul>
  </div>
</section>