Created
July 30, 2015 16:32
-
-
Save jimtrue/81c5455dde194552cec9 to your computer and use it in GitHub Desktop.
Archive Example using Pods API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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