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中获取页面链接和题目的相干PHP函数用法解析

get_permalink()(获取文章或页面链接) get_permalink() 用来依据固定衔接前往文章或许页面的链接。在获取...

详解WordPress中的头像缓存和代理中的缓存更新办法

wordpress评论中的头像是应用Gravatar的头像效劳(Gravatar民间注册地址:http://en.gravatar.com),用户的...

详解WordPress中分类函数wp_list_categories的应用

wp_list_categories 函数是 WordPress 中用来列举零碎中分类的函数,该函数领有许多管制输入的参数,明天忽...

处理更新WordPress3.7后DB-Cache缓冲插件抵触成绩

  Fatal error: Call to undefined method wpdb_2::delete() in   /home/*/public_html/wp-includes/o...

详解WordPress中用于更新和获取用户选项数据的PHP函数

update_user_option()函数 update_user_option()函数作用利用全局博客权限更新用户选项。 用户选项相似于用...

为wordpress绑定多个域名的办法分享

咱们都晓得,wordpress默许状况下会主动跳转到后盾规则的home_url下来,例如你的空间同时绑定了jb51.net和w...

需求提交

客服服务