mircobabini
8/15/2015 - 8:59 AM

wp.boilerplate.template-archive-portfolio.php

<?php
/**
 * Template Name: Portfolio Archive
 * Description: Used as a page template to show page contents, followed by a loop through a CPT archive  
 */
?>

<?php get_header() ?>

<?php
// prepare for the loop
$post_type = 'portfolio';
$query = new WP_Query( "post_type={$post_type}&nopaging=1" );
?>

<?php // run the loop ?>
<?php if ( $query->have_posts() ) : ?>
	<?php while ( $query->have_posts() ) : $query->the_post(); ?>

	<!-- template for each custom post in the archive -->
	<!-- example: -->
	<a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_title() ?></a>

	<?php endwhile; ?>
<?php else: ?>

	<!-- template for empty archive -->

<?php endif; ?>

<?php get_footer() ?>