I've been building my very first WordPress theme using the Advanced Custom Fields plugin. Here are the steps I've taken so far:

  1. Created custom post type via functions.php.
  2. Created archive-productions.php and customised the loop.
  3. Created single-productions.php and customised.

Everything is working perfectly!

I'd like to display archive-productions.php on the homepage, so i've created a page template. I've tried everything I can to get it working, but it's coming up blank.

I've spent many hours looking for a solution, but I've really hit a dead end. I always like to find my own solution, but on this occasion I need a push in the right direction. Your tips, links to tutorials or suggestions would be greatly appreciated.

Thank you!

Here's the loop I've tried on the page template:

<!-- Begin loop -->
   $args = array(
      'post_type' => 'productions_cpt'

<?php $counter =0; ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

  if($counter == 4) {
    $postclass = ' last';
    $counter = 0;
  } else { $postclass = ''; }

<div class="thumb<?php echo $postclass; ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?></a>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>

<?php endwhile; else: ?>
<p><?php _e('Sorry, no productions matched your criteria.'); ?></p>
<?php endif; ?>
<!-- End loop --> 
  • in your wordpress root directory search n open wp-config.php in this file look for define('WP_DEBUG', false); and change it to define('WP_DEBUG', true); now you can see error flashing on the page instead of a blank page Oct 1, 2013 at 18:53
  • can you check the code ... you are not getting the posts after defining the arguments use get_posts() or wp_query to get the posts Oct 1, 2013 at 18:55
  • I feel like such a noob. I just realised I have front-page.php set up with a standard loop. This explains why I wasn't seeing anything when I set a page template for the homepage. Thank you for your help! @wordpresser debug mode is great trick.
    – Sam
    Oct 2, 2013 at 10:20
  • am glad it'd help you Oct 2, 2013 at 11:07
  • Thanks to @MarutiMohanty too! Checked out the codex for get_posts() and wp_query.
    – Sam
    Oct 2, 2013 at 11:09

1 Answer 1


Using a page template I inserted this code:

$args = array( 'post_type' => 'productions', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    echo '<div class="entry-content">';
    echo '</div>';

Works like a charm. Now I just need to customise the loop so it looks pretty!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.