php-execプラグインを使って、作成ページ内にあるページの子ページリストを作ろうとしています。
リストの対照となる「親ページ」のidを1、「作成ページ」のidを2としたとき、
<?php
$posts=get_posts('numberposts=3&orderby=post_date
&post_type=page&post_parent=1');
?>
<?php if ($posts): foreach($posts as $post): setup_postdata($post) ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endforeach; endif; ?>
とコードを書き出したところ、作成されるリストが
- 作成ページ
- 作成ページ
- 作成ページ
となってしまい、「親ページ」の子ページリストが出力されません。どのようにコードを修正したらよいか、ご教示願います。