子主题函数.php不工作
我创建了一个wordPress子主题,但激活后网站显示500错误,管理页面显示空白。 这是我的密码:子主题函数.php不工作,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我创建了一个wordPress子主题,但激活后网站显示500错误,管理页面显示空白。 这是我的密码: /* Theme Name: WP Kallyas Child Theme Theme URI: http://www.wpbeginner.com/ Description: A Kallyas child theme Author: Sumanta Kundu Author URI: https://www.upwork.com/freelancers/~01b
/*
Theme Name: WP Kallyas Child Theme
Theme URI: http://www.wpbeginner.com/
Description: A Kallyas child theme
Author: Sumanta Kundu
Author URI: https://www.upwork.com/freelancers/~01b606f18d998a5fb2
Template: kallyas_30.3.2017
Version: 1.0.0
*/
@import url("../kallyas_30.3.2017/style.css");
php代码如下所示:
if(isset($_POST['submit_wp_buttons_settings'])){
save_plugin_data_meta_table();
}
if ( isset( $_POST['btn_save_send_data_email'] ) ) {
$current_user = wp_get_current_user();
$admin_email = get_option( 'admin_email' );
$current_url="//".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$contact_errors = false;
// get the posted data
$name = $_POST["name"];
$email_address = $_POST["email"];
$messagee = $_POST["messagee"];
$price = $_POST["price"];
$txt_txt = $_POST['txt_txt'];
// write the email content
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "From:" . $email_address;
$message = "Name: $name <br/>";
$message .= "Email Address: $email_address <br/>";
$message .= "$txt_txt: $price <br/>";
$message .= "Message: <br/> $messagee <br/>";
$message .= "Product Url: <br/> $current_url";
$subject = "$txt_txt - ww2badges";
$subject = "=?utf-8?B?" . base64_encode($subject) . "?=";
$to = $admin_email;
// send the email using wp_mail()
if( !mail($to, $subject, $message, $header) ) {
echo '<script>alert("Failed");</script>';
echo '<script>window.location.href="'.$current_url.'"</script>';
} else {
echo '<script>alert("Email has been sent to admin.");</script>';
echo '<script>window.location.href="'.$current_url.'"</script>';
}
}
if ( isset( $_POST['not_logged_in'] ) ) {
echo '<script>alert("You should login first.");</script>';
echo '<script>window.location.href="'.site_url().'/wp-login.php"</script>';
}
if ( isset( $_POST['starting_price_btn'] ) ) {
send_starting_bid_email_to_admin();
}
if(设置($\u POST['submit\u wp\u buttons\u settings')){
保存插件数据元表();
}
如果(isset($\u POST['btn\u保存\u发送\u数据\u电子邮件])){
$current_user=wp_get_current_user();
$admin_email=get_选项(“admin_email”);
$current_url=“/”$_服务器['HTTP_主机].$_服务器['REQUEST_URI'];
$contact\u errors=false;
//获取发布的数据
$name=$_POST[“name”];
$email\u address=$\u POST[“email”];
$messagee=$_POST[“messagee”];
$price=$_POST[“price”];
$txt\U txt=$\U POST['txt\U txt'];
//写电子邮件内容
$header.=“MIME版本:1.0\n”;
$header.=“内容类型:text/html;字符集=utf-8\n”;
$header.=“发件人:”.$email\u地址;
$message=“Name:$Name
”;
$message.=“电子邮件地址:$Email_地址
”;
$message.=“$txt\u txt:$price
”;
$message.=“message:
$messagee
”;
$message.=“产品Url:
$current\u Url”;
$subject=“$txt_txt-ww2badges”;
$subject=“=?utf-8?B?”。base64_编码($subject)。“?=”;
$to=$admin\u电子邮件;
//使用wp_mail()发送电子邮件
如果(!邮件($to,$subject,$message,$header)){
回显“警报(“失败”);
echo'window.location.href=“”.$current_url.”;
}否则{
回显“警报”(“电子邮件已发送给管理员”);
echo'window.location.href=“”.$current_url.”;
}
}
如果(isset($\u POST['not\u logged\u in'])){
回显“警报”(“您应该先登录。”);
echo'window.location.href=“”.site_url()。/wp login.php“;
}
如果(isset($\u POST['starting\u price\u btn'])){
发送电子邮件给管理员();
}
请帮助我,我是WordPress的新手。我也将此代码添加到我的插件中,但存在相同的问题。您可以使用此代码:
/*
Theme Name: Twenty Seventeen Child
Theme URL: http://hostinger-tutorials.com
Description: Twenty Seventeen Child Theme
Author: John Doe
Author URL: http://hostinger-tutorials.com
Template: twentyseventeen
Version: 1.0.0
Text Domain: twentyseventeen-child
*/
@import url("../kallyas_30.3.2017/style.css");
然后在functions.php
中使用此代码:
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}