Skip to content

Instantly share code, notes, and snippets.

@jimtrue
Created July 31, 2015 00:35
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/3f035a4c836834bf7c1a to your computer and use it in GitHub Desktop.
Save jimtrue/3f035a4c836834bf7c1a to your computer and use it in GitHub Desktop.
Single Actor Example Pods API Theme File
<?php
/*
Template Name: Actor Detail
*/
?>
<?php get_header(); ?>
<!-- Row for main content area -->
<div class="small-12 large-8 columns" id="content" role="main">
<?php /* Initiate the Pods Object */
// get the current slug
/* $slug = pods_v( 'last', 'url' ); */
global $post;
// get pods object
$mypod = pods( $post->post_type, $post->ID );
$actor = $mypod->id();
$title = $mypod->display('title');
$permalink = $mypod->display('permalink');
$videos = $mypod->field('related_videos');
?>
<article>
<header>
<h1 class="entry-title">
<a href="<?php echo $permalink; ?>"><?php echo $title; ?></a>
</h1>
</header>
<div class="entry-content">
<?php /* Output the Movies */
if (! empty( $videos )) { ?>
<h3>Movies:</h3>
<ul id="movie-list">
<?php
foreach ( $videos as $video ) {
$id = $video[ 'ID' ];
echo '<li><a href="' .get_permalink( $id ). '">' .get_the_title( $id ). '</a></li>';
}
}
?>
</div>
<footer>
</footer>
</article>
<?php comments_template(); ?>
</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