欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

WordPress無(wú)插件調(diào)用最新、熱門(mén)、隨機(jī)文章實(shí)例代碼

  發(fā)布時(shí)間:2013-06-05 16:50:08   作者:佚名   我要評(píng)論
WordPress無(wú)插件調(diào)用最新、熱門(mén)、隨機(jī)文章,具體實(shí)現(xiàn)代碼如下,感興趣的朋友可以參考下哈,希望對(duì)大家在新聞?wù){(diào)用上有所幫助
調(diào)用最新文章:

復(fù)制代碼
代碼如下:

<ul>
<?php $post_query = new WP_Query(‘showposts=10′);
while ($post_query->have_posts()) : $post_query->the_post();
$do_not_duplicate = $post->ID; ?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>

調(diào)用熱門(mén)文章:

復(fù)制代碼
代碼如下:

<ul>
<?php
$post_num = 10; // 設(shè)置調(diào)用條數(shù)
$args = array(
‘post_password’ => ”,
‘post_status’ => ‘publish’, // 只選公開(kāi)的文章.
‘post__not_in’ => array($post->ID),//排除當(dāng)前文章
‘caller_get_posts’ => 1, // 排除置頂文章.
‘orderby’ => ‘comment_count’, // 依評(píng)論數(shù)排序.
‘posts_per_page’ => $post_num
);
$query_posts = new WP_Query();
$query_posts->query($args);
while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>
<li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></li>
<?php } wp_reset_query();?>
</ul>

調(diào)用隨機(jī)文章:

復(fù)制代碼
代碼如下:

<ul>
<?php
global $post;
$postid = $post->ID;
$args = array( ‘orderby’ => ‘rand’, ‘post__not_in’ => array($post->ID), ‘showposts’ => 10);
$query_posts = new WP_Query();
$query_posts->query($args);
?>
<?php while ($query_posts->have_posts()) : $query_posts->the_post(); ?>
<li><a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>

相關(guān)文章

最新評(píng)論