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函数

home_url()(获取首页链接) ome_url() 函数用来获取 WordPress 的首页链接。 用法 home_url( $path, $sch...

wordpress搭建中英文双言语或多言语的网站详解

建设多言语切换的网站有两种形式,一种是子域名方式,另一种则是子目录方式。而以这两种方式建站,中文站点...

WordPress中缩略图的应用以及相干技巧

在博客上用到缩略图的机会很多, 它们呈现在文章列表页面, 文章下方的相干文章, 分类页面的类目图片, 甚至有...

WordPress自带thumbnail缩略图性能应用引见

1.增加性能 在function.php中拔出代码 add_theme_support('post-thumbnails'); 拔出之后会在后盾编辑文章的...

wordpress后盾增加子菜单的罕用几种状况及对应办法

1、在仪表盘增加子菜单: add_submenu_page( 'index.php', &hellip; ); 2、在文章处增加子菜单: add_submenu...

WordPress中非插件完成嵌套回复成果的办法

博客吧转载了零号相册的Wordpress博客自带嵌套回复教程。 自带嵌套性能工作原理: wordpress嵌套回复的工作...

需求提交

客服服务

亿鸽在线客服系统