I've been building my very first WordPress theme using the Advanced Custom Fields plugin. Here are the steps I've taken so far:
- Created custom post type via functions.php.
- Created archive-productions.php and customised the loop.
- 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 -->
<?php
$args = array(
'post_type' => 'productions_cpt'
)
);
?>
<?php $counter =0; ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
++$counter;
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>
</div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no productions matched your criteria.'); ?></p>
<?php endif; ?>
<!-- End loop -->
wp-config.php
in this file look fordefine('WP_DEBUG', false);
and change it todefine('WP_DEBUG', true);
now you can see error flashing on the page instead of a blank pageget_posts()
orwp_query
to get the posts