0

これは、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-->
4

1 に答える 1

3

あなたが持っているphpコードの最後の行は次のとおりです。

   <?php else : ?>

その制御構造を完成させる必要があります。次のようなものがありません:

   <?php endif; ?>
于 2012-05-17T18:04:30.230 に答える