-1

First I need to remove a period at the end of this function which displays a description on my wordpress theme. For example a particular description will display as........... Visit the wonderful city.

<?php post_description(); ?> 

After removing period, I need to add a city at the end of first function to make it 1 sentence, such as...Visit the wonderful city of Akron.

This is the taxonomy code that displays the city

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

here is entire code............

                        <!-- #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>

now I implemented this code.........

<?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 '.';
} ?>

But it displays as......... Visit the wonderful city. of Akron.

How can I remove the period while allowing period at end of sentence.

4

1 回答 1

0

为“参观美妙的城市”创建一个变量。并截断句点。然后使用现在缺少句点的变量代替该字符串来自的任何位置(我不使用 Wordpress)。

于 2012-08-05T23:10:00.703 回答