Guest User

Untitled

a guest
Jun 29th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.76 KB | None | 0 0
  1.       <?php
  2.         $aop_args = array(
  3.           'post_type' => 'areas_of_practice',
  4.           'post_status' => 'publish',
  5.           'post_parent' => 0,
  6.           'order_by' => 'menu_order',
  7.           'order' => 'ASC',
  8.         );
  9.         $the_query = new WP_Query( $aop_args );
  10.         if ( $the_query->have_posts() ) :
  11.           while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  12.           <li class="parent_aop">
  13.             <a class="parent-wrapper" href="<?php the_permalink(); ?>">
  14.             <?php
  15.             if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  16.                  the_post_thumbnail('medium');
  17.              } ?>
  18.              <span><?php the_title(); ?></span>
  19.            </a>
  20.             <ul class="child_list">
  21.             <?php
  22.             $theparentid = get_the_id();
  23.             //echo $theparentid;
  24.  
  25.             $aop_child_args = array(
  26.               'post_type' => 'areas_of_practice',
  27.               'post_status' => 'publish',
  28.               'post_parent' => $theparentid,
  29.               'order_by' => 'menu_order',
  30.               'order' => 'ASC',
  31.             );
  32.  
  33.             $the_child_query = new WP_Query( $aop_child_args );
  34.             if ( $the_child_query->have_posts() ) :
  35.               while ( $the_child_query->have_posts() ) : $the_child_query->the_post(); ?>
  36.                 <li class="child_aop">
  37.                 <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a>
  38.                 </li>
  39.                 <?php
  40.                 $thechildid = get_the_id();
  41.                 //echo $thechildid;
  42.             endwhile;
  43.           endif;
  44.           ?>
  45.           </ul>
  46.           </li>
  47.           <?php
  48.           endwhile;
  49.         endif;
  50.         wp_reset_query();
  51.       ?>
Advertisement
Add Comment
Please, Sign In to add comment