2017-03-15 54 views
0

它似乎我打破了我的WordPress的functions.php。 當編輯帖子或產品(Woocommerce),這裏是我得到的錯誤:我打破了我的WordPress的functions.php(WordPress的,PHP的)

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web22959994/html/repair/wp-content/themes/freestore-child/functions.php:24) in /var/www/web22959994/html/repair/wp-admin/post.php on line 197 

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web22959994/html/repair/wp-content/themes/freestore-child/functions.php:24) in /var/www/web22959994/html/repair/wp-includes/pluggable.php on line 1179 

由於錯誤說,這個問題似乎是在functions.php中。我已經證實完全清空它可以解決錯誤。 這裏是我的functions.php:

<?php 
function my_theme_enqueue_styles() { 

$parent_style = 'freestore'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme. 

wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css'); 
wp_enqueue_style('child-style', 
    get_stylesheet_directory_uri() . '/style.css', 
    array($parent_style), 
    wp_get_theme()->get('Version') 
); 
} 

add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles'); 
add_filter('loop_shop_per_page', create_function('$cols', 'return 16;'), 20); 
add_filter('woocommerce_variable_free_price_html', 'hide_free_price'); 
add_filter('woocommerce_free_price_html', 'hide_free_price'); 
add_filter('woocommerce_variation_free_price_html', 'hide_free_price'); 
function hide_free_price($price){ 
return ('Ab 99'); 
}; 
?> 

我已經跑了通過一些PHP跳棋,並沒有發現問題。其中大部分是非常基本的東西(爲子主題打造風格,通過過濾器編輯一些小功能)。但它似乎被打破,我個人不知道爲什麼。

感謝您的幫助!

+1

你在php標籤之前或之後有空白嗎? – Paul

+0

是的,我只是注意到我做了。刪除它,它被修復了。完全我的不好。感謝你的回答! – RadicalM1nd

+0

在PHP文件末尾忽略關閉php標記被認爲是最佳做法。 –

回答

0

好吧,我想我自己做了一個完整的**。在結束標記後我有兩行額外的行。問題已修復。

相關問題