Skip to content

Instantly share code, notes, and snippets.

@jimtrue
Created July 30, 2015 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimtrue/81c5455dde194552cec9 to your computer and use it in GitHub Desktop.
Save jimtrue/81c5455dde194552cec9 to your computer and use it in GitHub Desktop.
Archive Example using Pods API
<?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(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment