Wordpress特定文章列表的调用代码

admin WordPress教程 0

调用网站最新文章:

<?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();?> <?php the_time('Y-m-d'); ?></a></li>
<?php endwhile; ?>

调用随机文章:

query_posts('showposts=10&orderby=rand');

调用某个分类下的最新文章:

query_posts('showposts=10&cat=1'); //cat=1为调用ID为1的分类下文章

排除某个分类下的文章:

query_posts('showposts=10&cat=-1'); //cat=-1为排除ID为1的分类下文章

免责声明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。敬请谅解!

您需要 登录账户 后才能发表评论

欢迎 你 发表评论: