【问题标题】:syntax error, unexpected 'endif' (T_ENDIF) on line 288 [closed]语法错误,第 288 行出现意外的“endif”(T_ENDIF)[关闭]
【发布时间】:2014-06-15 16:30:52
【问题描述】:

我一直在为我的 worpress 网站离线处理此代码错误。

解析错误:语法错误,第 288 行 /homez.541/photoher/marie/wp-content/themes/hemingway/functions.php 中的意外 'endif' (T_ENDIF)

行代码错误第 288 行:<p class="comment-awaiting-moderation"><?php _e( 'Awaiting moderation', 'hemingway' ); ?></p>

这是错误的完整代码:

    <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">

        <?php __( 'Pingback:', 'hemingway' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'hemingway' ), '<span class="edit-link">', '</span>' ); ?>

    </li>
    <?php
            break;
        default :
        global $post;
    ?>
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">

        <div id="comment-<?php comment_ID(); ?>" class="comment">

            <div class="comment-meta comment-author vcard">

                <?php echo get_avatar( $comment, 120 ); ?>

                <div class="comment-meta-content">

                    <?php printf( '<cite class="fn">%1$s %2$s</cite>',
                        get_comment_author_link(),
                        ( $comment->user_id === $post->post_author ) ? '<span class="post-author"> ' . __( '(Post author)', 'hemingway' ) . '</span>' : ''
                    ); ?>

                    <p><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"><?php echo get_comment_date() . ' at ' . get_comment_time() ?></a></p>

                </div> <!-- /comment-meta-content -->

            </div> <!-- /comment-meta -->

            <div class="comment-content post-content">

                <?php if ( '0' == $comment->comment_approved ) : ?>

                    <p class="comment-awaiting-moderation"><?php _e( 'Awaiting moderation', 'hemingway' ); ?></p>

                <?php endif; ?>

                <?php comment_text(); ?>

                <div class="comment-actions">

                    <?php edit_comment_link( __( 'Edit', 'hemingway' ), '', '' ); ?>

                    <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'hemingway' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

                    <div class="clear"></div>

                </div> <!-- /comment-actions -->

            </div><!-- /comment-content -->

        </div><!-- /comment-## -->
    <?php
        break;
    endswitch;
}
endif;

请帮帮我。

【问题讨论】:

  • 我没有看到应该与 endif 匹配的 if

标签: php wordpress


【解决方案1】:

你不应该有} endif;

使用if (...) {}if (...):/endif;,但不要同时使用。

【讨论】:

    猜你喜欢
    • 2014-10-15
    • 1970-01-01
    • 2018-11-06
    • 2021-09-16
    • 2018-04-03
    • 2017-10-30
    • 2013-12-07
    • 1970-01-01
    • 2014-10-16
    相关资源
    最近更新 更多