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

wordpress調(diào)用特定文章列表的技巧分享

  發(fā)布時(shí)間:2014-08-03 14:32:13   作者:佚名   我要評(píng)論
在 wordpress主題制作開發(fā) 中經(jīng)常會(huì)需要在特定的頁(yè)面中調(diào)用出指定的文章或文章列表,接下來(lái)教大家如何調(diào)用出 wordpress文章列表 。

調(diào)用網(wǎng)站最新文章:


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

<?php
query_posts('showposts=10&orderby=new'); //showposts=10表示10篇
while(have_posts()): the_post();
?>
<li><a href="<?php the_permalink(); ?>"target="_blank"><?php the_title() ?></a></li> //這里可以寫成你自己需要的樣式
<?php endwhile; ?>

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


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

<?php
query_posts('showposts=10&orderby=rand'); //showposts=10表示10篇
while(have_posts()): the_post();
?>
<li><a href="<?php the_permalink(); ?>"target="_blank"><?php the_title() ?></a></li> //這里可以寫成你自己需要的樣式
<?php endwhile; ?>

調(diào)用某個(gè)分類下的最新文章:


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

<?php
query_posts('showposts=10&cat=1'); //cat=1為調(diào)用ID為1的分類下文章
while(have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>

排除某個(gè)分類下的文章:


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

<?php
query_posts('showposts=10&cat=-1'); //cat=-1為排除ID為1的分類下文章
while(have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>

以上就是文章列表的調(diào)用方法,可以將例子中的代碼結(jié)合起來(lái)達(dá)到你需要的效果。

相關(guān)文章

最新評(píng)論