我试图用引导选项卡在我的index.php主题,以显示在主页主题diferent内容。 我实现了在index.php文件选项卡,并创建新的页面叫做流行-post.php中的标签热门链接。
但是,当我点击链接显示受欢迎的内容,我得到
致命错误:调用未定义功能get_header()在
这是我的index.php的代码
<?php get_header(); ?>
<div class="row" id="content">
<div class="col-sm-8 col-md-8 col-lg-8" id="primary">
<ul class="nav nav-tabs">
<li class="active"><a href="#">Home</a></li>
<li><a href="<?php bloginfo('template_directory'); ?>/popular-post.php">Popular</a></li>
<li><a href="#">Recientes</a></li>
</ul>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to overload this in a child theme then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>
<?php endwhile;?>
<?php /* Pagnavi plugin support */ wp_pagenavi(); ?>
<?php else: ?>
<?php get_template_part( 'no-results', 'index' ); ?>
<?php endif; ?>
</div>
<div class="col-sm-4 col-md-4 col-lg-4" id="secondary">
<?php get_sidebar(); ?>
</div>
</div><!--/content-->
<?php get_footer(); ?>
一个这是流行-post.php中的代码
<?php
/*
Template Name: Popular Posts
*/
?>
<?php get_header(); ?>
<div class="row" id="content">
<div class="col-sm-8 col-md-8 col-lg-8" id="primary">
<ul class="nav nav-tabs">
<li><a href="<?php bloginfo('template_directory'); ?>">Home</a></li>
<li class="active"><a href="#">Popular</a></li>
<li><a href="#">Recientes</a></li>
</ul>
<ul class="popular_posts">
<?php $pc = new WP_Query('orderby=comment_count&posts_per_page=10');
while ($pc->have_posts()) : $pc->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<p>Posted by <strong><?php the_author() ?></strong> with <?php comments_popup_link('No Comments;', '1 Comment', '% Comments'); ?></p></li>
<?php endwhile; ?>
</ul>
</div>
<div class="col-sm-4 col-md-4 col-lg-4" id="secondary">
<?php get_sidebar(); ?>
</div>
</div><!--/content-->
<?php get_footer(); ?>
提前致谢