index.php 테마에서 부트 스트랩 탭을 사용하여 기본 페이지 테마에 다른 내용을 표시하려고합니다. 나는 index.php에서 탭을 구현하고 인기있는 탭에 링크 된 popular-post.php라는 새 페이지를 만듭니다.새 php page wordpress에 링크
내가 인기있는 콘텐츠를 표시하기 위해 링크를 클릭하면 그러나 나는 얻을
치명적인 오류 :
에 정의되지 않은 함수 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(); ?>
이 ADVAN에
<?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(); ?>
덕분에 인기-post.php의 코드 ce
좋아요! get_pemalink에 에코를 추가하는 것만으로도 완벽하게 작동합니다! 그렇게 쉬운 일이었고 나는 미쳐 버렸습니다. 다른 질문 : 지금은 지역에서 일하고 있는데, 내 서버에 테마를 업로드 할 때 WordPress의 관리자 패널에서 인기있는 게시물 페이지를 만들고 ID를 변경해야만합니까 ?? – Trenton
해결 방법으로 답을 업데이트했습니다 (그리고'echo'가 누락되었습니다). – brasofilo