This question already has an answer here:
I'm following this tutorial for custom post types: http://www.elegantthemes.com/blog/tips-tricks/creating-custom-post-types-in-wordpress
I'm using underscore starter wp theme. http://underscores.me/
I've created a page-movie-reviews.php file with the code bellow, but I get a syntax error on the page: Parse error: syntax error, unexpected 'endif' (T_ENDIF) in C:\wamp\www\wordpress\wp-content\themes\prototype\page-movie-reviews.php on line 34
my code:
<?php
/**
* Template Name: Movie Reviews
* @package prototype
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="entry-content">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
the_content();
?>
</div>
<?php $query = new WP_Query( array('post_type' => 'movie-reviews', 'posts_per_page' => 5 ) );
while ( $query->have_posts() ) : $query->the_post(); ?>
<?php endif; wp_reset_postdata(); ?>
<?php endwhile; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
</div>