I have a custom post type called "films", and most films have a subpage (child page) called "press".
I am trying to loop through the films, and check to see if a subpage exists. If a subpage exists, loop through the content. If it doesn't exist, leave out the content. My loop is as follows:
<?php $loop = new WP_Query( array( 'post_type' => 'films', 'posts_per_page' => 8,'orderby' => 'date', 'order' => 'ASC', 'film-categories' => 'available-now-shows-on-homepage' ) ); ?> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php endwhile; ?>
I only want the linked title to show if it's page has children (a press page). How would I modify the loop to do just that?