解析错误:语法错误,在本地主机(wordpress主题)上测试的文件的意外结束


Parse error: syntax error, unexpected end of file tested on localhost (wordpress theme)

我想从头开始创建一个wordpress主题,然后在本地主机上测试它。这段代码来自front-page.php

我一直得到这个错误:

Parse error: syntax error, unexpected end of file in C:'wamp'www'director'front-page.php on line 56 (第56行是代码的最后一行)

的代码:

<?php get_header(); ?>
<?php
    $posts= get_posts(array('numberposts' => 4,'category' => 3, orderby => 'title'));
    foreach ($posts as $post) : setup_postdata($post); ?>
    <h3><?php the_title(); ?></h3>
    <?php the_excerpt(); ?>
    <?php endforeach; ?>
?>
<?php
    $args= array('post_type' => 'businesses', 'posts_per_page' => 1, 'tax_query' => array(array('taxonomy' => 'business-type', 'field' => 'slug', 'terms' => 'featured')));
    $featuredBusiness=get_posts($args);
        foreach ($featuredBusiness as $post) : setup_postdata($post);
?>
    <div id="featured" class="group">
    <div class="business-info right-col">
        <hr/>
        <h3>Featured Business:</h3>
        <h2><?php the_title(); ?></h2>
        <p><?php the_excerpt(); ?></p>
    </div>
    <div class="impact-image">
        <?php print get_the_post_thumbnail($post->ID, 'storefront'); ?>
    </div>
    </div>
    <?php endforeach; ?>
    <div id="main" class="group">
        <div id="posts" class="left-col">
            <?php
                $posts= get_posts('posts_per_page=3');
                foreach ($posts as $post) : setup_postdata($post); ?>
            <div class="post group">
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                    <div class="byline">by <?php the_author_posts_link(); ?>
                        on <a href="<?php the_permalink(); ?>"><?php the_time('l F d, Y'); ?></a>
                    </div>
                <p><?php the_excerpt(); ?></p>
            </div>
            <?php
                $blogID=get_page_by_path('blog');
                $blogLink=get_page_link($blogID->ID);
            ?>
            <a class="visit" href=" <?php print $blogLink; ?>">Visit the Blog</a>
        </div>
    <?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>

我检查了,但我似乎没有错过任何结束标签或其他东西。是我漏掉了什么还是没看到?

关闭最后一个foreach循环…

<?php get_header(); ?>
<?php
    $posts= get_posts(array('numberposts' => 4,'category' => 3, orderby => 'title'));
    foreach ($posts as $post) : setup_postdata($post); ?>
    <h3><?php the_title(); ?></h3>
    <?php the_excerpt(); ?>
    <?php endforeach; ?>
?>
<?php
    $args= array('post_type' => 'businesses', 'posts_per_page' => 1, 'tax_query' => array(array('taxonomy' => 'business-type', 'field' => 'slug', 'terms' => 'featured')));
    $featuredBusiness=get_posts($args);
        foreach ($featuredBusiness as $post) : setup_postdata($post);
?>
    <div id="featured" class="group">
    <div class="business-info right-col">
        <hr/>
        <h3>Featured Business:</h3>
        <h2><?php the_title(); ?></h2>
        <p><?php the_excerpt(); ?></p>
    </div>
    <div class="impact-image">
        <?php print get_the_post_thumbnail($post->ID, 'storefront'); ?>
    </div>
    </div>
    <?php endforeach; ?>
    <div id="main" class="group">
        <div id="posts" class="left-col">
            <?php
                $posts= get_posts('posts_per_page=3');
                foreach ($posts as $post) : setup_postdata($post); ?>
            <div class="post group">
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                    <div class="byline">by <?php the_author_posts_link(); ?>
                        on <a href="<?php the_permalink(); ?>"><?php the_time('l F d, Y'); ?></a>
                    </div>
                <p><?php the_excerpt(); ?></p>
            </div>
            <?php
                $blogID=get_page_by_path('blog');
                $blogLink=get_page_link($blogID->ID);
            ?>
            <a class="visit" href=" <?php print $blogLink; ?>">Visit the Blog</a>
 <?php endforeach; ?>
        </div>
    <?php get_sidebar(); ?>
    </div>
 <?php get_footer(); ?>