Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $aop_args = array(
- 'post_type' => 'areas_of_practice',
- 'post_status' => 'publish',
- 'post_parent' => 0,
- 'order_by' => 'menu_order',
- 'order' => 'ASC',
- );
- $the_query = new WP_Query( $aop_args );
- if ( $the_query->have_posts() ) :
- while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
- <li class="parent_aop">
- <a class="parent-wrapper" href="<?php the_permalink(); ?>">
- <?php
- if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
- the_post_thumbnail('medium');
- } ?>
- <span><?php the_title(); ?></span>
- </a>
- <ul class="child_list">
- <?php
- $theparentid = get_the_id();
- //echo $theparentid;
- $aop_child_args = array(
- 'post_type' => 'areas_of_practice',
- 'post_status' => 'publish',
- 'post_parent' => $theparentid,
- 'order_by' => 'menu_order',
- 'order' => 'ASC',
- );
- $the_child_query = new WP_Query( $aop_child_args );
- if ( $the_child_query->have_posts() ) :
- while ( $the_child_query->have_posts() ) : $the_child_query->the_post(); ?>
- <li class="child_aop">
- <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a>
- </li>
- <?php
- $thechildid = get_the_id();
- //echo $thechildid;
- endwhile;
- endif;
- ?>
- </ul>
- </li>
- <?php
- endwhile;
- endif;
- wp_reset_query();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment