<?php 
// Template name: Sitemap

get_header(); 

	get_template_part('partials/template', 'hero'); 

    $download = get_field('download'); ?>

<section class="page-section main-content-section">
	<div clas

		<div class="row">

			<div class="col s12 m10 push-m1 l8 push-l2">

						
						<div class="index-content has_content">
							

							<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
								<?php the_content(); ?>

							<?php endwhile; else : ?>
								<p><?php _e( 'Sorry, nothing was found.' ); ?></p>
							<?php endif; ?>


							<!-- //list sitemap elements -->

							<h2>Pages</h2>

							<ul>
							<?php
							wp_list_pages( array( 
							  'exclude' => '',
							  'title_li' => '',
							) ); ?>
							</ul>

							<?php
							foreach( get_post_types( array('public' => true) ) as $post_type ) {

							  if ( in_array( $post_type, array('post','page', 'pages', 'attachment', 'spucpt', 'gallery', 'maps', 'snp_popups', 'snp_ab', 'snp_mail_log') ) ) {
							   //do nothing
							  } else { 
							  
								  $pt = get_post_type_object( $post_type );

								  echo '<h2>' . $pt->labels->name . '</h2>';
								  echo '<ul>';
								  query_posts('post_type=' . $post_type . '&posts_per_page=-1');
								  while( have_posts() ) {
								    the_post();
								    echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
								  }
								  echo '</ul>';
								}
							}
							?>
						</div>



		

			</div>


		</div> 
	</div>
</section>


<?php $panels = get_field('panel_environment_201703131208b_panels'); ?>
<?php if ($panels): ?>

	<?php if( have_rows('panel_environment_201703131208b_panels') ): ?>
	    <section class="page-section clearfix ">
	    <?php while( have_rows('panel_environment_201703131208b_panels') ): the_row(); 
	        $panels_title = get_sub_field('panels_title');
	        $panels_label = get_sub_field('panels_label');
	        $panels_content = get_sub_field('panels_content');
	        $panels_button = get_sub_field('panels_button');
	        ?>
	        	<div class="section-inner plain_text">
	        		<div class="container">

	        			<div class="wysiwyg">
	        				<h2 class="section-title">
	        					<?php echo $panels_title; ?>
	        				</h2>
	        				<?php echo $panels_content; ?>
	        				<?php echo $panels_button; ?>
	        			</div>
	        		</div>
	        	</div>
	    <?php endwhile; ?>
	    </section>
	<?php endif; ?>

<?php endif; ?>


<?php

	get_template_part('partials/template', 'pagesections'); 
?>


<?php get_footer(); ?>