0
我有一个问题包装与html标签outputed内容。HTML不会包装wordpress php the_content()
我写这个..
<p class='pWrap'>
<?php the_content(); ?>
</p>
,并得到这个..
<p class='pWrap'>
</p>
<p>Content</p>
我也试着写这样的..
<?php echo "<p class='pWrap'>" ?>
<?php the_content(); ?>
<?php echo "</p>" ?>
,但相同的结果。
为什么会发生这种情况?
总代码段看起来是这样的..
<article>
<?php query_posts('posts_per_page=8'); ?>
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<p class='pWrap'>
<?php the_content(); ?>
</p>
</li>
<?php endwhile; ?>
<?php endif; ?>
你可以检查没有包装'html'?只是为了确保你的while循环正在工作。 –
无论我是否尝试包装它,都会显示所有帖子的内容。 –
嗯,那么你可以试试@xphan的答案。 –