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在装置应用中呈现404、403、500及502成绩的剖析与处理办法

前言 最近在应用WordPress的时分遇到了一些谬误提醒,置信大家在应用wordpress建设网站的时分,都会遇到一些...

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

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

制止wordpress主动将半角转换为全角 制止全角和半角的转换

找到wp-includes/formatting.php文件中复制代码代码如下:// This is not a tag, nor is the texturization ...

wordpress增加mp3音频文件教程

上传音频和视频文件应用媒体上传到WordPress是很容易的。虽然媒体上传意识到这些文件,并显示相应的文件类型...

wordpress更改用户列表排序(按注册工夫排序)教程

在 WordPress 后盾,用户是依照用户名排序的,并且没有显示注册工夫,假如咱们心愿可以在后盾看到用户的注册...

Wordpress选项标签性能

要害字形容:性能 标签 选项 设置 能够 文章 默许 Blog 这个 用户 上次课程咱们解说 Wordpress 用户的治理...

需求提交

客服服务