dongxing1853 2017-03-15 15:57
浏览 57

我打破了我的WordPress functions.php(Wordpress,PHP)

it seems like I broke my Wordpress functions.php. When editing Posts or Products (Woocommerce), here's the error I'm getting:

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

As the error says, the problem seems to be in the functions.php. I have confirmed that by emptying it out completely, which resolves the error. Here's my 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');
};
?>

I've ran it through some PHP checkers and haven't found an issue. Most of it is pretty basic stuff (enqueing a style for the child theme, editing some small functions via filter). However it seems to be broken and I personally don't know why.

Thanks for any help!

  • 写回答

1条回答 默认 最新

  • dongqiu8375 2017-03-15 16:10
    关注

    Well, guess i made a complete a** out of myself. I had two extra lines after the closing tag. Issue is fixed.

    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧