Working WordPress Template using Meta Boxes PHP Class
<?php
/*
Template Name: Episode Guide Archives
*/
get_header(); ?>
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[0];
} else {
$parent = $post->ID;
}
$page_data = get_page($page_id);
?>
<!-- START Content Wrapper -->
<div id="wrapper" class="group">
<!-- START PBS PARENTS MAIN -->
<div id="pbsparents-main">
<!-- START SECTION LEFT -->
<div class="section left">
<?php get_template_part( 'inc', 'sitebanner' ); ?>
<?php get_template_part( 'inc', 'main-nav' ); ?>
<!-- START CONTENT CONTAINER -->
<div class="content-container">
<?php get_template_part( 'inc', 'socialmedia' ); ?>
<div class="epiguide-seasons clear">
<p class="season-title">Season 10</p>
<ul>
<li class="local-listings"><a href="<?php bloginfo('url'); ?>/tv-schedules/">Check Local Listings</a></li>
</ul>
</div>
<div id="single-activities-page" class="clear">
<?php
//The Query
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'paged'=>$paged, //Pulls the paged function into the query
'cat' => 18,
'posts_per_page'=>-1, //Limits the amount of posts on each page
);
query_posts($args);
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="clear">
<hr />
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<!-- CATEGORY NAME HERE -->
</header><!-- .entry-header -->
<div class="entry-content">
<h2 class="episode-guide-title"><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', '' ) . '</span>', 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
<!-- START Episode Preview -->
<div class="related-epi-preview">
<?php if ( get_post_meta($post->ID, '_pbsparents_repthmb', true) ) { ?>
<h3>Episode Preview</h3>
<div class="video-pops">
<a class="thumb video-pop" href="<?php echo get_post_meta($post->ID, '_pbsparents_repvid', true); ?>">
<span></span>
<img width="157" height="88" alt="<?php the_title(); ?> image" src="<?php echo get_post_meta($post->ID, '_pbsparents_repthmb', true); ?>" />
</a>
</div>
<?php } ?>
<ul>
<?php if ( get_post_meta($post->ID, '_pbsparents_repkids', true) ) { ?>
<li class="full-episode"><a href="<?php echo get_post_meta($post->ID, '_pbsparents_repkids', true); ?>">Watch Full Episode</a></li>
<?php } ?>
<?php if ( get_post_meta($post->ID, '_pbsparents_repitunes', true) ) { ?>
<li class="dl-itunes"><a href="<?php echo get_post_meta($post->ID, '_pbsparents_repitunes', true); ?>">Download from iTunes</a></li>
<?php } ?>
<?php if ( get_post_meta($post->ID, '_pbsparents_reppodcast', true) ) { ?>
<li class="podcast"><a href="<?php echo get_post_meta($post->ID, '_pbsparents_reppodcast', true); ?>">Subscribe to Podcast</a></li>
<?php } ?>
<?php if ( get_post_meta($post->ID, '_pbsparents_reprelact', true) ) { ?>
<li><p><strong>Related Activities</strong></p>
<?php $meta = get_post_meta( $post->ID, '_pbsparents_reprelact', true );
foreach ( $meta as $value )
{
echo '<p>';
echo $value;
echo '</p>';
} ?>
</li>
<?php } ?>
</ul>
</div><!-- // END Episode Preview -->
</div>
<?php endwhile; endif; ?>
</div>
<?php wp_pagenavi(); ?>
<?php $wp_query = null; $wp_query = $temp;?>
</div><!-- // END CONTENT CONTAINER -->
<?php if (get_option('ppp_fs_code') ) { ?>
<div class="funding-sponsors">
<?php echo stripslashes(get_option('ppp_fs_code')); ?>
</div>
<?php } ?>
</div><!-- // END SECTION LEFT -->
<!-- START SECTION RIGHT -->
<div class="section right">
<?php get_sidebar(); ?>
</div><!-- // END SECTION RIGHT -->
</div><!-- // END PBS PARENTS MAIN -->
</div><!-- // END Content Wrapper -->
<?php get_footer(); ?>