WordPress PHP:意外的$End错误


Wordpress PHP: Unexpected $End Error

这是我第一次使用WordPress模板,也是我第一次使用PHP(除了偶尔的服务器(。 也就是说,我对PHP一无所知,只是勉强掌握了语法。

正在尝试创建一些自定义循环,一旦我得到一个工作,我只需复制粘贴工作代码,更改 ID,并期望它有效。也许很傻? 无论如何,我在 203 行上得到了一个意想不到的$end。

有人愿意告诉我是什么原因造成的吗?提前感谢!

<!-- FEATURED LOOP -->
<div class="featured">
<?php $my_query = new WP_Query('category_name=featured&showposts=1'); ?>
<?php if ( have_posts() ) : ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <?php do_atomic( 'before_entry' ); // origin_before_entry ?>
        <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
            <?php do_atomic( 'open_entry' ); // origin_open_entry ?>
            <?php
            if ( current_theme_supports( 'get-the-image' ) ) {                              
                if ( is_sticky ( $post->ID ) ) {
                    get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'image_class' => 'featured' ) );
                } else {
                    get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail', 'image_class' => 'featured' ) );
                }
            }
            ?>
            <div class="sticky-header">
                <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
                <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] &middot; by [entry-author] &middot; in [entry-terms taxonomy="category" before=""] [entry-edit-link before=" &middot; "]', 'origin' ) . '</div>' ); ?>                 
            </div><!-- .sticky-header -->
            <div class="entry-summary">
                <?php the_excerpt(); ?>
                <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'origin' ), 'after' => '</p>' ) ); ?>
            </div><!-- .entry-summary -->
            <?php do_atomic( 'close_entry' ); // origin_close_entry ?>
        </div><!-- .hentry -->
        <?php do_atomic( 'after_entry' ); // origin_after_entry ?>
    <?php endwhile; ?>
    <?php wp_reset_postdata(); // reset the query ?>
<?php else : ?>
<!--END FEATURED LOOP-->    
<!-- SUBFEATURED LOOP -->
<div class="subfeatured">
<?php $my_query = new WP_Query('category_name=subfeatured&showposts=1'); ?>
<?php if ( have_posts() ) : ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <?php do_atomic( 'before_entry' ); // origin_before_entry ?>
        <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
            <?php do_atomic( 'open_entry' ); // origin_open_entry ?>
            <?php
                if ( current_theme_supports( 'get-the-image' ) ) {
                    if ( is_sticky ( $post->ID ) ) {
                        get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'image_class' => 'featured' ) );
                    } else {
                        get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail', 'image_class' => 'featured' ) );
                    }
                }
            ?>
            <div class="sticky-header">
                <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
                <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] &middot; by [entry-author] &middot; in [entry-terms taxonomy="category" before=""] [entry-edit-link before=" &middot; "]', 'origin' ) . '</div>' ); ?>
            </div><!-- .sticky-header -->
            <div class="entry-summary">
                <?php the_excerpt(); ?>
                <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'origin' ), 'after' => '</p>' ) ); ?>
            </div><!-- .entry-summary -->
            <?php do_atomic( 'close_entry' ); // origin_close_entry ?>
        </div><!-- .hentry -->
        <?php do_atomic( 'after_entry' ); // origin_after_entry ?>
    <?php endwhile; ?>  
    <?php wp_reset_postdata(); // reset the query ?>
<?php else : ?>         
<!--END SUBFEATURED LOOP-->

你拥有的最后一行 php 代码是:

   <?php else : ?>

您需要完成该控制结构。您缺少以下内容:

   <?php endif; ?>