Home > php教程 > php手册 > body text

wordpress列出所有分类目录下一定数量的文章

WBOY
Release: 2016-06-06 20:09:19
Original
1489 people have browsed it

不影响主LOOP, 分页正常工作 限制每个分类下文章数量 列出所有分类, 不用指定 ul ?php/** * wordpress list limited number of posts group by all categories * without destroying the main hook * coded by xiaohudie * i promised i'd use English to an

  1. 不影响主LOOP, 分页正常工作
  2. 限制每个分类下文章数量
  3. 列出所有分类, 不用指定
Copy after login
    5, // limit number //'ignore_sticky_posts'=>1,// defult:0 not ignore 'category__in' => array($category->term_id) //use category id to hook the category parameters ); $xhdpost = get_posts( $args ); echo '

    Category: name ) . '" ' . '>' . $category->name.'

    '; foreach ( $xhdpost as $post ) : setup_postdata($post); ?>

Demo:
20130508132438
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!