wordpress怎样挪用特定文章列表?
正在 wordpress主题制造开发 中常常会需求正在特定的页面中挪用出指定的文章或文章列表,接上去教各人若何挪用出 wordpress文章列表 。
保举:《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技术
版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。