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 SQL查问语句

以下代码来自网络,未经测试,操作数据库有危险,请事前备份 !为一切文章和页面增加自定义字段 这段代码能...

wordpress暴门路 影响一切版本

缺点文件/{Path}/wp-includes/registration-functions.php 要害代码: &mdash;-> <?php /** * Deprecated. N...

如何进行Wordpress的后盾设置

要害字形容:设置 后盾 进行 如何 这里 Wordpress 选项 能够 网站 你曾经阅读了这个 Wordpress 架设的站点...

Wordpress迁徙后图片地址谬误成绩的处理办法

WordPress改换空间后 需求调整的几个中央? 1.数据库衔接配置文件 wp-config.php 2.查看.htaccess文件,并修...

WordPress 搜寻框增加文字提醒的办法

如在 Nicky 的博客中, 我发现了下图中的搜寻栏. 在搜寻栏中增加这样的提醒信息, 能够疏导访客对网站进行搜...

需求提交

客服服务