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的答案。 –