I'm having a hard time figuring out how to display the title of the childpages as the id of a div. Assuming that 'news' & 'othernews' are siblings of the parent page home (39)
I want something like this:
<div class="wrapper" id="news">
content
</div>
<div class="wrapper" id="othernews">
content
</div>
This is my function for my shortcode:
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;
}
}
}
parent_page
, it'spost_parent
. and you reset the query and return inside of your while loop, so it can't possibly run for more than 1 iteration before exiting.