下载了一个wordpress的网站模板,但是运行的时候提示:Fatal error: Call to undefined function get_header() in E:\phpprj\NewsGz\index.php on line 1求各位大牛告知怎么运行这个网站,wordpress已经安装好了。

解决方案 »

  1.   

    get_headers你自己加的?看看代码
      

  2.   

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme and one of the
     * two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query.
     * For example, it puts together the home page when no home.php file exists.
     *
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     *
     * @package WordPress
     * @subpackage Kornio CenturyThemes Theme
     * @since Kornio 1.0
     */
    get_header(); ?>
        <?php 
            ctts_get_blog_data();
            global $blog_data;
            
            $sidebar_position = $blog_data['sidebar_position'];
            $content_class =  'col-md-9';
            if($sidebar_position == 'none') {
                $content_class =  'col-md-12 fullwidth';  
            }else if($sidebar_position == 'left'){
                $content_class .= ' col-md-push-3';    
            };
                    $content_class .= " {$blog_data['layout']}-container";
            add_filter( 'post_class', 'post_layout_class'); 
            function post_layout_class($classes){
                global $blog_data;
                $classes[] = "post-{$blog_data['layout']}";
                return $classes;
            }
            
            if($blog_data['layout'] == 'medium'){
                $blog_data['loop_sp_class'] .= ' medium-left';        
                $blog_data['loop_text_class'] .= ' medium-right';        
            }
            
            if($blog_data['layout'] == 'grid'){
                wp_enqueue_script( 'ctts-freewall', CTTS_JS_DIR_URI .'/freewall.js', array( 'jquery' ), '1.04', true );     
                add_action('wp_footer', 'create_grid_layout',1000); 
            }
        ?>
            <div class="row">
                <div id="content" class="site-content <?php echo $content_class ?>" role="main">
                    <?php if ( have_posts() ) { ?>
                        <div id="blog-wrap" class="clr">
                            <?php while ( have_posts() ) : the_post(); ?>
                                <?php get_template_part( 'content', get_post_format() ); ?>
                            <?php endwhile; ?>
                        </div><!-- #post -->
                        <div class="pagination pagination-centered">
                        <?php ctts_pagination(); ?>
                        </div>
                    <?php } else { ?>
                        <?php get_template_part( 'content', 'none' ); ?>
                    <?php } ?>
                </div><!-- #content -->
                <?php if($sidebar_position != 'none') get_sidebar(); ?>  
            </div><?php get_footer(); ?>难道是因为wordpress的版本问题?get_headers是php本身内置的函数,get_header是wordpress的。
      

  3.   


    WordPress函数:get_header(获取头部)你这是模板文件,不能单独执行的
      

  4.   

    哦,那怎么运行下载下来的wordpress网站呢,斑竹?
      

  5.   

    get_header是wordpress模版方法方法,需要运行wordpress调用,不能直接访问。
    你下载模版后放入template/xxx/然后在wordpress后台就可以选择theme了。选择后保存即可。
      

  6.   

    你这个错误没遇到过,不过我猜有一种可能,就是在你的项目中有没有header.php这个文件