如何做到这一点:
页码:
主页-sub-1-sub-1-sub-1-sub-1
在主页上,应仅显示first child-page 类似:sub-1
我发现了这个:
<?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = \'page\' ORDER BY menu_order", \'OBJECT\'); ?>
<?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<h2 class="subpagetitle"><a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a></h2>
<?php endforeach; endif; ?>
但这对我根本不起作用。标题将显示两次,并显示所有子页面标题(sub-1、sub-sub-1、sub-sub-sub-1)
谢谢Ogni