extract( shortcode_atts( array( 'limit' => '10' ), $atts ) );
ob_start();
global $wp;
- //$custom_terms = get_terms( CATEGORY_SLUG );
+ // Get all top level posts
+ $topArgs = array(
+ 'orderby' => 'menu_order',
+ 'order' => 'ASC',
+ 'post_type' => POST_TYPE,
+ 'post_parent' => 0
+ );
+ $parentPosts = get_posts( $topArgs );
echo '<div class="package-container">';
- //foreach($custom_terms as $custom_term) {
+ foreach( $parentPosts as $parentPost ) {
+ //echo '<pre>$parentPost: ' . print_r( $parentPost, true ) . '</pre>';
wp_reset_query();
$args = array(
'posts_per_page' => -1,
- 'post_type' => POST_TYPE,
- 'orderby' => 'menu_order',
- 'order' => 'ASC',
- //'tax_query' => array(
- //array(
- //'taxonomy' => CATEGORY_SLUG,
- //'field' => 'slug',
- //'terms' => $custom_term->slug,
- //),
- //),
+ 'post_type' => POST_TYPE,
+ 'orderby' => 'menu_order',
+ 'order' => 'ASC',
+ 'post_parent' => $parentPost->ID
);
- $loop = new WP_Query($args);
- if($loop->have_posts()) {
+ $loop = new WP_Query( $args );
+ //echo '<pre>$loop: ' . print_r( $loop, true ) . '</pre>';
+ if ( $loop->have_posts() ) {
echo "<div class='package-container-$custom_term->term_id'>";
- echo "<h2 class='$custom_term->term_id'>".$custom_term->name.'</h2>';
+ echo '<h2 id="tcp-' . $parentPost->post_title . '">'.$parentPost->post_title.'</h2>';
echo '<ul>';
- while($loop->have_posts()) : $loop->the_post();
+ while ( $loop->have_posts() ) : $loop->the_post();
// Get the image
$thumbnail = get_the_post_thumbnail( null, 'packageList' );
- if ( !$thumbnail ) {
- echo '<h2 id="tcp-' . get_the_title() . '">' . get_the_title() . '</h2>';
- continue;
- }
// Get the meta data
$custom = get_post_custom();
//echo '<pre>$custom: ' . print_r( $custom, true ) . '</pre>';
echo '</div>';
}
- //}
+ }
echo '</div>';
$output = ob_get_contents();
ob_end_clean();