wordpress调用特定文章列表的技巧分享

调用网站**文章:


<?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; ?>

调用随机文章:


<?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; ?>

调用某个分类下的**文章:


<?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; ?>

扫除某个分类下的文章:


<?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; ?>

以上就是文章列表的调用办法,能够将例子中的代码结合起来达到你需求的成果。

以上就是安达网络工作室关于《wordpress调用特定文章列表的技巧分享》的一些看法。更多内容请查看本栏目更多内容!

本文相关话题: wordpress 文章列表
版权声明:本文为 安达网络工作室 转载文章,如有侵权请联系我们及时删除。
相关文章
WordPress统计以后页面数据库查问次数及耗费工夫的办法

本文实例讲述了WordPress统计以后页面数据库查问次数及耗费工夫的办法。分享给大家供大家参考。详细剖析如下...

WordPress中获取指定分类及其子分类下的文章数目

获取特定分类文章数 有时分咱们想获取某个分类(category)下的文章数目,以便在博客的某个中央显示进去。上面...

WordPress博客零碎搜寻引擎优化seo全攻略

1.空间的抉择 wordpress要求 php+mysql的支持,rewrite性能,比方apache的mod-rewrite或iis rewrite。 空间...

WordPress用户登录框明码的暗藏与局部显示技巧

让WordPress登录页的明码框显示最初一个输出的字符 在通常状况下,网页的设计者们会将明码输出框中的一切字...

WordPress装置前的预备工作

要害字形容:工作 预备 装置 &nbsp 数据库 用户 创立 权限 应用 软件 解说 WordPress 的装置前的一些预备工...

多个WordPress站点应用同一数据库的办法

尚未装置WordPress 在初始配置WordPress之前,将wp-config.php中的$table_prefix值(默许为wp_)修正为所需求...

需求提交

客服服务

亿鸽在线客服系统