2014-01-18 78 views
0

我创建了自己的主题。在我的头版(index.php)上,我展示了一些帖子,最后是“阅读更多”链接。所以当我点击阅读更多时,我被重定向到该帖子的页面(localhost/wordpress/2014/post-title/),但在那里,我看不到帖子的标题,但是看到了所有内容。WordPress的帖子从链接重定向时不显示标题

中的index.php代码片断

<div id="blog" class="container"> 

     <?php query_posts('showposts=3'); ?> 
     <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> 

     <div class="post col-md-4"> 
     <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> 

      <div class="entry"> 
       <?php the_post_thumbnail(); ?> 

       <?php the_excerpt(__('(more…)')); ?> 
       <p class="postmetadata"> 
       <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php the_author(); ?><br /> 
       <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?> 

       </p> 

      </div> 
     </div> 
<?php endwhile; ?> 

     <div class="navigation"> 
     <?php posts_nav_link(); ?> 
     </div> 

     <?php endif; ?> 


    </div> 

那么,如何让文章标题呢?

+2

你的主题中是否有single.php?如果你这样做,请发布它的代码。 – Kaloyan

+0

哦!我没有包含该文件。 –

回答

0

我认为人们不能帮助你用这段代码解决这个问题。如果该帖子的页面没有显示帖子标题,那么您需要检查single.php

可能您可能忘记在该文件中添加<?php the_title(); ?>部分。

+0

我的主题文件夹中没有single.php文件。是否有必要添加? –

+0

是的,除非你使用儿童主题,否则Single.php对任何主题都很重要。 – ScorpionGod

相关问题