Integrating Pods Template in the Loop

How to output a Pods Template inside a PHP Template file with the Loop

Many times you’ve already designed a really good Pods Template, but you need to do more than just adding it to single and custom loops with our Auto Templates. A good time this might be necessary is when something else is providing the Loop and you just want to make sure it uses your Pods Template for the Loop output.

<!-- Start the Loop. -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
	global $post;
	echo pods('Pod Name',$post->ID)->template('Template Name');
	
<!-- Stop The Loop (but note the "else:" - see next line). -->
<?php endwhile; else : ?>

	<!-- The very first "if" tested to see if there were any Posts to -->
	<!-- display.  This "else" part tells what do if there weren't any. -->
	<p><?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?></p>

	<!-- REALLY stop The Loop. -->
<?php endif; ?>

Questions