2017-02-24 51 views
0

我遇到了僅在一個頁面/組件上,BuddyPress腳本正在以文本形式打印到頁面的情況。這發生在用戶配置文件的「更改封面圖像」選項卡上,而我在其他任何地方都沒有看到此問題。BuddyPress腳本以純文本打印出來?

我試着用Google搜索關鍵字的每個組合,我可以想到,並試圖在BuddyPress支持論壇發帖,但一直沒能得到任何幫助。

也許這裏的某個人可能能夠給我提供一些見解?

Here's a screenshot of what the page looks like.

模板文件看起來像:

<?php 
/** 
* BuddyPress Cover Images main template. 
* 
* This template is used to inject the BuddyPress Backbone views 
* dealing with cover images. 
* 
* It's also used to create the common Backbone views. 
* 
* @since 2.4.0 
* 
* @package BuddyPress 
* @subpackage bp-attachments 
*/ 
?> 

<div class="bp-cover-image"></div> 
<div class="bp-cover-image-status"></div> 
<div class="bp-cover-image-manage"></div> 

<?php bp_attachments_get_template_part('uploader'); ?> 

<script id="tmpl-bp-cover-image-delete" type="text/html"> 
<# if ('user' === data.object) { #> 
    <p><?php _e("If you would like to delete your current cover image but not upload a new one, please use the delete Cover Image button.", 'buddypress'); ?></p> 
    <p><a class="button edit" id="bp-delete-cover-image" href="#"><?php esc_html_e('Delete My Cover Image', 'buddypress'); ?></a></p> 
<# } else if ('group' === data.object) { #> 
    <p><?php _e("If you would like to remove the existing group cover image but not upload a new one, please use the delete group cover image button.", 'buddypress'); ?></p> 
    <p><a class="button edit" id="bp-delete-cover-image" href="#"><?php esc_html_e('Delete Group Cover Image', 'buddypress'); ?></a></p> 
<# } else { #> 
    <?php do_action('bp_attachments_cover_image_delete_template'); ?> 
<# } #> 
</script> 

<?php do_action('bp_attachments_cover_image_main_template'); ?> 

和所有的實際上兩倍的頁面本身在內嵌腳本標記爲文章全文如圖所示的出現,一度再一次上面的截圖。

我沒有得到任何javascript錯誤,我可以在我的控制檯中看到。

我真的很感謝任何能夠幫助我排除故障的人。

謝謝!

回答

0

嗯,我有這個問題約一個星期,但只有9小時後發佈這個問題在這裏我隨機偶然發現問題的來源。我非常肯定這將是一個腳本加載順序問題,但沒有 - 這是我的孩子主題的functions.php文件中的片段,旨在刪除空的HTML標記:

add_filter('the_content', 'remove_empty_tags_recursive', 20, 1); 
function remove_empty_tags_recursive ($str, $repto = NULL) { 
    $str = force_balance_tags($str); 
    if (!is_string ($str) || trim ($str) == '') 
    return $str; 
    return preg_replace (
      '~\s?<p>(\s|&nbsp;)+</p>\s?~', 
     !is_string ($repto) ? '' : $repto, 
     $str 
    ); 
}