个性化阅读
专注于IT技术分析

子主题functions.php无法正常工作

我创建了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/~01b606f18d998a5fb2
Template:     kallyas_30.3.2017
Version:      1.0.0
*/
@import url("../kallyas_30.3.2017/style.css");

而且functions.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();
}

请帮助我, 我是WordPress的新手。我也将此代码添加到了我的插件中, 但存在相同的问题。


#1


你可以使用此:

/*
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' );
}

你可以从托管服务商那里了解更多信息

赞(0)
未经允许不得转载:srcmini » 子主题functions.php无法正常工作

评论 抢沙发

评论前必须登录!