我很难弄清楚如何将子页面的标题显示为div的id“其他新闻”是父页面主页(39)的同级
我想要这样的东西:
<div class="wrapper" id="news">
content
</div>
<div class="wrapper" id="othernews">
content
</div>
这是我的短代码函数:function content_block( $atts, $content = null ){
extract( shortcode_atts( array(
\'type\' => \'white\'
), $atts));
$childArgs = array(
\'post_type\' => \'page\',
\'parent_page\' => 39
);
$child = new WP_Query($childArgs);
if ($child->have_posts()) {
while ($child->have_posts()) {
$child->the_post();
if ($type == \'white\') {
$return .= \'<div class="col-white">\';
$return .= \'<div class="wrap" id="\'. get_the_title() .\'">\';
$return .= do_shortcode($content);
$return .= \'</div>\';
$return .= \'</div>\';
} else
if ($type == \'grey\') {
$return .= \'<div class="col-grey">\';
$return .= \'<div class="wrap" id="\'. get_the_title() .\'">\';
$return .= do_shortcode($content);
$return .= \'</div>\';
$return .= \'</div>\';
}
wp_reset_query();
return $return;
}
}
}