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主题制造之模板文件的引入办法

get_template_part() 用来援用模板文件,相似于 get_header()、get_sidebar() 和 get_footer(),只不过这个...

WordPress插件和主题编写时cookie应如何设置

编写WordPress插件和主题的时分,常常需求用到cookie,比方存取用户形态等,我之前编写的插件Ludou Simple ...

wordpress后盾关上迟缓的处理办法(暂时)

最近关上博客后盾,发现后盾关上速度很慢。 经过开发者调试工具对网络加载进行检测,发现是因为后盾应用了谷...

WordPress迁徙时一些常见成绩的处理办法整顿

一、导入数据库提醒数据表已存在 以周良博客应用的主机商-主机91为例,提供了phpMyAdmin性能的,导入数据库...

WordPress言语切换(例如中文版和英文版转换)

首先关上网站根目录下的 wp-config.php,而后搜寻 define('WPLANG' 就能够疾速定位到言语设置那里 比方简体...

WordPress源代码中文乱码的处理办法

查看相干教程,UTF-8和UTF-8 + BOM有所区别,于是把function.php编码改为后者。成绩处理。 UFT-8 与UTF-8 B...

需求提交

客服服务