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.

    评论

报告相同问题?

悬赏问题

  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害