在 WordPress主题制作开发 中经常会需要在特定的页面中调用出指定的文章或文章列表,接下来教大家如何调用出 wordpress文章列表 。
调用网站最新文章:
代码如下:
<?php qUEry_posts('showposts=10&orderby=new'); //showposts=10表示10篇 while(have_posts()): the_post(); ?>登录后复制
调用随机文章:
代码如下:
<?PHP query_posts('showposts=10&orderby=rand'); //showposts=10表示10篇 while(have_posts()): the_post(); ?>登录后复制
调用某个分类下的最新文章:
代码如下:
<?php query_posts('showposts=10&cat=1'); //cat=1为调用id为1的分类下文章 while(have_posts()) : the_post(); ?>登录后复制
排除某个分类下的文章:
代码如下:
<?php query_posts('showposts=10&cat=-1'); //cat=-1为排除ID为1的分类下文章 while(have_posts()) : the_post(); ?>登录后复制