如何删除第一个函数末尾的句点,同时允许组合函数后末尾的句点


How to remove period at end of first function while allowing period at end after combining function

首先,我需要删除该函数末尾的一个句点,该句点显示对wordpress主题的描述。例如,一个特定的描述将显示为……参观这座美丽的城市。

<?php post_description(); ?> 

删除句号后,我需要在第一个函数的末尾添加一个城市,使其成为1句话,比如…参观阿克伦的美妙城市。

这是显示城市的分类代码

 <?php echo appthemes_get_custom_city($post->ID, CITY_TAX_NAME, 'name'); ?>**

这是完整的代码。。。。。。。。。。。。

                        <!-- #main -->
                    </div> <!-- #head-box -->
                    <div class="box-bottom">&nbsp;</div>
                    <div class="text-box">
                    <?php appthemes_before_post_description(); ?>
                    <?php appthemes_post_description(); ?>
                    <?php post_description(); ?>
                    <?php city_edit_link(); ?>
                    <?php clpr_reset_link(); ?>
                    <?php appthemes_after_post_description(); ?> 
                  </div>

现在我实现了这个代码。。。。。。。。。

<?php
$content = trim(get_the_content());
if(substr($content, -4) == '</p>') {
echo substr($content, 0, -4);
echo appthemes_get_custom_city($post->ID, CITY_TAX_NAME, 'name');
echo '</p>';
}
else{
echo $content, of, " ",  appthemes_get_custom_city($post->ID, CITY_TAX_NAME, 'name');                                                          
echo '.';
} ?>

但它显示为……参观这座美妙的城市。阿克伦。

我如何删除句号,同时允许在句末使用句号。

为"参观美妙的城市"创建一个变量,并截断句点。然后使用现在缺少句点的变量来代替字符串的来源(我不使用Wordpress)。