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チェッカーを通してそれを走ってきましたし、問題を発見していません。そのほとんどはかなり基本的なものです(子テーマのスタイルをエンキューし、フィルタを使って小さな関数を編集する)。しかし、それは壊れているようだと私は個人的に理由を知らない。
ありがとうございました!
phpタグの前後に空白がありますか? – Paul
ええ、私はちょうど私が気づいた。それを削除し、修正されました。完全に私の悪い。答えをありがとう! – RadicalM1nd
phpファイルの最後に閉じるphpタグを省略することをお勧めします。 –