2009-12-11 112 views
0

最近我一直在制作WordPress主题,刚刚一些代码停止工作。帖子格式化消失了,现在我只是在每个帖子里面都有一段文字!下面是该职位的PHP代码:WordPress主题问题

<?php get_header(); ?> 
    <div id="content"> 
     <div class="wrap"> 
      <div id="leftcol"> 
<?php if (have_posts()) : ?> 

    <?php while (have_posts()) : the_post(); ?> 
       <div class="post" id="post-<?php the_ID(); ?>"> 
        <div class="meta alignleft"> 
         <span class="date"><?php the_time('F j, y') ?></span> 
         <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span> 
         <span class="tags"><?php the_tags('', ', ', ''); ?></span> 
        </div> 
        <div class="body alignright"> 
         <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> 
         <?php the_excerpt(); ?> 
        </div> 
        <div class="clear"></div> 
       </div> 
    <?php endwhile; ?> 

    <ul> 
     <li><?php next_posts_link('&laquo; Older Entries') ?></li> 
     <li><?php previous_posts_link('Newer Entries &raquo;') ?></li> 
    </ul> 

<?php else : ?> 

    <h2>Not Found</h2> 
    <p>Sorry, but you are looking for something that isn't here.</p> 

<?php endif; ?> 

      </div> 
     </div> 
    </div> 

这是在主题文件夹中的index.php文件的所有代码。我在帖子的左侧有帖子的一些元数据,在右侧有帖子的实际帖子。

这是什么是输出到页面。 (这只是什么#内容DIV中,有太多对我来说,一切都张贴)

<div id="content"><div class="wrap"> 
<div id="leftcol"> 
    <p>This is some random text that’s added just for effect. Thanks for the consideration. This is some random text that’s added just for effect. Thanks for the consideration. This is some random text that’s added just for effect. Thanks for the consideration. This is some random text that’s added just f<a href="#">or effect. Thanks for</a> the consideration. </p> 
    <p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! Welcome to WordPress</p> 
</div></div></div> 

发生了什么事!?

+0

这是一个编程问题,属于stackoverflow。 – tbird 2009-12-11 18:04:37

回答

0

你的意思是唯一得到处理的是<?php the_excerpt(); ?>。或者是一切都被解析,但你没有公布由<?php the_time('F j, y') ?>生成的其他spans之间的东西?

如果是这种情况,那么仅仅是使用另一个模板标签的问题。 the_excerpt只发布帖子的一小部分,限于一定数量的字符。如果你想显示整篇文章,你需要使用the_content

+0

我解决了我自己的问题......我所做的是命名主页 - 模板文件“home.php”。显然,wordpress将它作为博客页面模板文件...我只是将其重命名为“page-home.php”,并且它再次运行... – codedude 2009-12-12 17:57:41