Trying to separate courpress pages from normal posts.

We have a few lines of code in the default page of our custom theme:

<?php get_header();?>

<!-- Secondary Nav -->
<!-- Show Secondary Menu if the page is a child or has children -->
<?php global $post; $children = get_pages( array( 'child_of' => $post->ID ) );

	if ( is_page() && $post->post_parent  || count( $children ) > 0 ) : ?>

		<div class="row subnav">
			<div class="container">
				<div class="columns large-12">

<ul>
					    <?php wp_list_pages( array('title_li'=>'','depth'=>1,'child_of'=>get_post_top_ancestor_id()) ); ?>
					</ul>
				</div>
			</div>
		</div>

	<?php else : ?>
	<!--This is a parent page without children -->

	<?php endif; ?>

This handles our secondary navigation. I didn't build it, but now I gotta fix it. Now, in normal site operation. This causes no problems. It loads up all the links in the subnavigation and off she goes. It's only when we start loading up er.... I dunno... Virtual pages? That stuff breaks.

For instance, if I go to here: http://test.missionsinterlink.org.au/courses/

You'll see a bajillion links in the secondary nav. This isn't specifically coursepress's fault. It's happened with buddypress and similar plugins.

What I am asking though, because I've search everywhere and hunted through the code and searched the github and put up stackexchange questions and really haven't had any useful answers.

So I'm throwing this out to the original creators. I'm no expert on wordpress and dealing the billion interlocking mechanisms is a pain in the butt.

How do I tell this little snippet of code to not load every page that doesn't have a parent in the submenu for this one section of your plugin.

P.S. Please don't suggest recoding the coursepress theme. I'm here because I've already tried that and don't have six months to learn how to work around the weird intricacies of wordpress. This isn't my arena of expertise.