Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 分析错误:语法错误,在本地主机上测试的文件意外结束(wordpress主题)_Php_Wordpress_Parsing_Localhost - Fatal编程技术网

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

Php 分析错误:语法错误,在本地主机上测试的文件意外结束(wordpress主题),php,wordpress,parsing,localhost,Php,Wordpress,Parsing,Localhost,我正在尝试从头创建wordpress主题,然后在localhost上测试它。这段代码来自front-page.php 我不断地发现这个错误: Parse error:syntax error,第56行C:\wamp\www\director\front-page.php中的文件意外结束 (第56行是代码的最后一行) 使用此代码: <?php get_header(); ?> <?php $posts= get_posts(array('numberposts' =&

我正在尝试从头创建wordpress主题,然后在localhost上测试它。这段代码来自front-page.php

我不断地发现这个错误:

Parse error:syntax error,第56行C:\wamp\www\director\front-page.php中的文件意外结束
(第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(); ?>

?>

特色业务:

通过 在…上


您可以发布
get\u footer()
函数吗?您错过了结束上次的
foreach
loop@PieterGoosen啊,谢谢,现在可以了!