代码如下:
<?php
query_posts('showposts=10&cat=1'); //cat=1为调用ID为1的分类下文章
while(have_posts()) : the_post(); ?>
<li><a title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php
query_posts('showposts=10&cat=1'); //cat=1为调用ID为1的分类下文章
while(have_posts()) : the_post(); ?>
<li><a title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
排除某个分类下的文章:
代码如下:
<?php
query_posts('showposts=10&cat=-1'); //cat=-1为排除ID为1的分类下文章
while(have_posts()) : the_post(); ?>
<li><a title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
以上就是文章列表的调用方法,可以将例子中的代码结合起来达到你需要的效果。
<?php
query_posts('showposts=10&cat=-1'); //cat=-1为排除ID为1的分类下文章
while(have_posts()) : the_post(); ?>
<li><a title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
以上就是文章列表的调用方法,可以将例子中的代码结合起来达到你需要的效果。
标签:WordPress
相关阅读 >>
wordpress中is_sticky()判断文章是否置顶的参数与用法
wordpress导航菜单函数wp_nav_menu()详解
更多相关阅读请进入《wordpress》频道 >>
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。