0
我下面這個教程自定義文章類型: http://www.elegantthemes.com/blog/tips-tricks/creating-custom-post-types-in-wordpress自定義後類型在語法錯誤意外ENDIF WP結果
我使用下劃線啓動WP主題。 http://underscores.me/
我創建的代碼波紋管, 一個頁面電影reviews.php文件,但我得到的頁面上的語法錯誤: 解析錯誤:語法錯誤,意外「ENDIF」(T_ENDIF)在C:\ WAMP \ WWW \ WordPress的\可溼性粉劑內容\主題\在線原型\頁面電影reviews.php 34
我的代碼:
<?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(); ?>
您正在使用「花括號」語法「If(something){// code}」,它不需要'endif;'語句 –