我最近一直在制作一个wordpress主题,而现在一些代码就停止了工作。帖子格式消失了,现在我的每个帖子里面都有一个带有文字的段落!这是帖子的PHP代码:
<?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('« Older Entries') ?></li>
<li><?php previous_posts_link('Newer Entries »') ?></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文件中的所有代码。我在帖子的左侧有一些帖子的元数据,在右侧有实际的帖子。
这是页面的输出。 (这只是#content 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 :(得分:0)
你的意思是唯一被处理的是<?php the_excerpt(); ?>
。或者是一切都被解析了,但是你没有将<?php the_time('F j, y') ?>
生成的内容发布在另一个spans
之间?
如果是这样的话,那就是使用另一个模板标签。 the_excerpt
仅发布一小部分帖子,仅限于一定数量的字符。如果您要显示整个帖子,则需要使用the_content
。