Archive-Video from PodsCast #4

Shows how to construct a standard post type archive using Pods functions to control the loop and field display.

<?php
/*
Template Name: Video Archive
*/
?>

<?php get_header(); ?>

<!-- Row for main content area -->
	<div class="small-12 large-8 columns" id="content" role="main">
		<h1>All Videos</h1>

	<?php /* Start the Pods Loop */

	// Pulling PODS Loop instead of WP Loop
	$mypod = pods('video');
	$params = array(
		/*		'limit' => -1, /* Change to Posts per page */
		/*    'limit' => get_option('posts_per_page',15), /* Change to Posts per page */
		'limit' => 2,
		);
	$mypod->find($params);
	?>

	<?php while ( $mypod->fetch() ) : ?>
		<?php

		// set our variables
		$video = $mypod->id();
		$title = $mypod->display('title');
		$permalink = $mypod->display('permalink');
		$actors = $mypod->field('related_actors');
		$imagehtml = get_the_post_thumbnail( $video, 'full', array( 'class' => 'thumbnail' ));
		?>
		<article>
			<header>
				<a href="<?php echo esc_url($permalink); ?>" title="<?php echo esc_attr($title); ?>">
					<?php echo $imagehtml; ?>
					<h2 class="entry-title"><?php echo $title; ?></h2>
				</a>
			</header>
		</article>


	<?php endwhile; ?>
	<?php echo $mypod->pagination(); ?>

	</div>
	<?php get_sidebar(); ?>

<?php get_footer(); ?>

 

Questions