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主题言语包(汉化主题)

通过这次yHtml5主题的制造,我学会了怎样给主题制造言语包,就是普通的汉化主题啦。废话不多说,说步骤。 首...

WordPress中is_singular()函数简介

函数is_singular()检测后果为true,当上面其一前往true时:is_single()、is_page()、is_attachment()。 假如...

应用WordPress发送电子邮件的相干PHP函数用法解析

wp_mail() 函数用来发送邮件,相似于 PHP 的 mail() 函数。 默许的发件人称号是 WordPress,发件人邮箱是相...

Wordpress(Wp)3.5版修正默许上传图片门路的处理办法

置信接触过WP零碎的冤家都理解,老版零碎的上传图片门路是默许指向wp-content目录下的。做过WP博客的冤家应...

WordPress主题构造是如何架构的图文分析

利用弱小的技术,能够把基于WordPress的网站做成各种各样的方式,这除了要求WordPress主题开发人员通晓HTML...

以JavaScript来完成WordPress中的二级导航菜单的办法

导航菜单 导航菜单早已 "深化民意", 在博客上的使用日益重要且多样. 从本文开端, 我将展开几个对于 WordPre...

需求提交

客服服务