如何删除 和 来自the_excerpt()?

问题描述 投票:0回答:3

我有一个简短的描述,但当我试图显示描述wordpress添加<p><br><strong>,如何删除?看看这张照片:

enter image description here

我的代码是这样的:

        </span>
            <span class="address-place">
             <?php echo the_excerpt (); ?>
             <hr>
        </span>
php html wordpress
3个回答
2
投票

strip_tags似乎是你正在寻找的:

<?php echo strip_tags(the_excerpt()); ?>

0
投票
<?php
$myExcerpt = get_the_excerpt();
$tags = array("<p>", "</p>");
$myExcerpt = str_replace($tags, "", $myExcerpt);
?>
</span>
<span class="address-place">
<?php   echo $myExcerpt; ?>
<hr>
</span>

0
投票

答案就在这里。也许对某人有用。 get_the_excerpt()

© www.soinside.com 2019 - 2024. All rights reserved.