이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

PJW Query Child Of

설명

This plugin allows you to run loops within your WordPress templates where you query for children of the current page.

The plugin extra arguments to the list of arguments supported by query_posts().

The query argument child_of is used to add a WHERE to the database query to limit the pages returned to those with a post_page equal to the argument provided.

The query argument child_limit is used to limit the number of pages returned.

The query argument child_offset is used to offset the limiting to allow for pagination if required.

설치

  1. Upload to your plugins folder, usually wp-content/plugins/
  2. Activate the plugin on the plugin screen.
  3. Use the new query variables in calls to query_posts()

FAQ

How can I use this in a page template?

The plugin is used when you call query_posts() from a theme template file so as to run your own query.

The following code is an example of what you could do to generate a list of the first 10 child pages from a parent page:

<div id="children">
        <dl>
        <?php query_posts('static=true&child_limit=10&child_of='.$id.'&order=ASC'); ?>
        <?php if(have_posts()) : while (have_posts()) : the_post(); ?>
        <dt><a href="<?php the_permalink();?>"><?php the_title();?>:</a></dt>
                <dd style=""><em><?php the_excerpt(); ?></em></dd>
        <?php endwhile; endif; ?>
        </dl>
</div>
How can I create a a page template which lists children of children?

If you want to create a hierarchical display with children of children then you will need to use nested loops which requires some care.

You will need to have the most up-to-date version of this plugin and then you can use the examples which are included with it in the page-templates folder.

The basic loops needed for a nested solution are as follows:

<div id="children">
        <dl>
        <?php query_posts('static=true&posts_per_page=-1&post_parent='.$id.'&order=ASC'); ?>
        <?php if(have_posts()) : while (have_posts()) : the_post(); ?>
        <?php   $inner_query = new WP_Query("post_type=page&posts_per_page=-1&post_parent={$id}&order=ASC");
                while ($inner_query->have_posts()) : $inner_query->the_post(); ?>
                    <dt><a href="<?php the_permalink();?>"><?php the_title();?>:</a></dt>
                    <dd style=""><em><?php the_excerpt(); ?></em></dd>
        <?php endwhile; endwhile; endif; ?>
        </dl>
</div>
How do I set an excerpt for a Page?

If you want to set an excerpt for a page then you need to install my Page Excerpt plugin and this will add an excerpt box to the “Edit Page” so that you can enter one.

This plugin can be found here: https://wordpress.org/extend/plugins/pjw-page-excerpt/

후기

이 플러그인에 대한 평가가 없습니다.

기여자 & 개발자

“PJW Query Child Of”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “PJW Query Child Of”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

v0.01

  • Initial Release

v0.02

  • Fix logical bug.

v1.00

  • Improved release with added child_limit and child_offset variables

v1.10

  • Added page template examples to documentation and repository.
  • Added extra FAQ answers.
  • Changed the child_of query variable to rewrite to using post_parent instead if the WordPress version is new enough (v2.6 or later)