Wednesday, 18 September 2013

Wordpress: Displaying posts of category PHP error

Wordpress: Displaying posts of category PHP error

I'm working on a WordPress site and am trying to display posts of a
certain type through a page template. I have searched around and
technically the following code should work but doesn't... PHP must throw
an error, because it does not display any output from this code:
<?php
$args = array( 'post_type' => 'gazette',
'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="row-fluid newsPost">';
echo '<div class="span3">';
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
echo '</div>';
echo '<div class="span9">';
echo '<span class="newsTitle">';
the_title();
echo '</span>';
echo '<span class="newsDate">';
the_date();
echo '</span>';
echo '<em>';
the_excerpt();
echo '</em>';
echo '</div>';
echo '</div>';
endwhile;
?>
Anyone have any idea why this isn't working? The post_type correlates to
my custom post type "gazette" ...

No comments:

Post a Comment