gpt4 book ai didi

javascript - 解析错误 : syntax error, 文件意外结尾 WordPress 主题

转载 作者:行者123 更新时间:2023-12-01 05:34:12 25 4
gpt4 key购买 nike

错误:解析错误:语法错误,/Applications/MAMP/htdocs/volcano/wp-content/themes/volcano_1.01/inc/function-admin.php 第 144 行中的文件意外结束我一直在使用我的 WordPress 主题。我目前工作于管理面板。我在 MAMP 服务器上的测试环境中使用它。我做错事情了。如果有人可以看一下,那将非常有帮助。谢谢!

<?php

/*

@package volcanotheme

========================
ADMIN PAGE
========================
*/

function volcano_add_admin_page() {

//Generate Volcano Admin Page
add_menu_page( 'Volcano Theme Options', 'volcano', 'manage_options', 'testernick_volcano', 'volcano_theme_create_page', get_template_directory_uri() . '/img/screenshot.png', 110 );

//Generate Volcano Admin Sub Pages
add_submenu_page( 'testernick_volcano', 'Volcano Sidebar Options', 'Sidebar', 'manage_options', 'testernick_volcano', 'volcano_theme_create_page' );
add_submenu_page( 'testernick_volcano', 'Volcano Theme Options', 'Theme Options', 'manage_options', 'testernick_volcano_theme', 'volcano_theme_support_page' );
add_submenu_page( 'testernick_volcano', 'Volcano CSS Options', 'Custom CSS', 'manage_options', 'testernick_volcano_css', 'volcano_theme_settings_page');

}
add_action( 'admin_menu', 'volcano_add_admin_page' );

//Activate custom settings
add_action( 'admin_init', 'volcano_custom_settings' );

function volcano_custom_settings() {
//Sidebar Options
register_setting( 'volcano-settings-group', 'profile_picture' );
register_setting( 'volcano-settings-group', 'first_name' );
register_setting( 'volcano-settings-group', 'last_name' );
register_setting( 'volcano-settings-group', 'user_description' );
register_setting( 'volcano-settings-group', 'twitter_handler', 'volcano_sanitize_twitter_handler' );
register_setting( 'volcano-settings-group', 'facebook_handler' );
register_setting( 'volcano-settings-group', 'gplus_handler' );

add_settings_section( 'volcano-sidebar-options', 'Sidebar Option', 'volcano_sidebar_options', 'testernick_volcano');

add_settings_field( 'sidebar-profile-picture', 'Profile Picture', 'volcano_sidebar_profile', 'testernick_volcano', 'volcano-sidebar-options');
add_settings_field( 'sidebar-name', 'Full Name', 'volcano_sidebar_name', 'testernick_volcano', 'volcano-sidebar-options');
add_settings_field( 'sidebar-description', 'Description', 'volcano_sidebar_description', 'testernick_volcano', 'volcano-sidebar-options');
add_settings_field( 'sidebar-twitter', 'Twitter handler', 'volcano_sidebar_twitter', 'testernick_volcano', 'volcano-sidebar-options');
add_settings_field( 'sidebar-facebook', 'Facebook handler', 'volcano_sidebar_facebook', 'testernick_volcano', 'volcano-sidebar-options');
add_settings_field( 'sidebar-gplus', 'Google+ handler', 'volcano_sidebar_gplus', 'testernick_volcano', 'volcano-sidebar-options');

//Theme Support Options
register_setting( 'volcano-theme-support', 'post_formats' );
register_setting( 'volcano-theme-support', 'custom_header' );
register_setting( 'volcano-theme-support', 'custom_background' );

add_settings_section( 'volcano-theme-options', 'Theme Options', 'volcano_theme_options', 'testernick_volcano_theme' );

add_settings_field( 'post-formats', 'Post Formats', 'volcano_post_formats', 'testernick_volcano_theme', 'volcano-theme-options' );
add_settings_field( 'custom-header', 'Custom Header', 'volcano_custom_header', 'testernick_volcano_theme', 'volcano-theme-options' );
add_settings_field( 'custom-background', 'Custom Background', 'volcano_custom_background', 'testernick_volcano_theme', 'volcano-theme-options' );
}


function volcano_theme_options() {
echo 'Activate and Deactivate specific Theme Support Options';


function volcano_post_formats() {
$options = get_option( 'post_formats' );
$formats = array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' );
$output = '';
foreach ( $formats as $format ){
$checked = ( @$options[$format] == 1 ? 'checked' : '' );
$output .= '<label><input type="checkbox" id="'.$format.'" name="post_formats['.$format.']" value="1" '.$checked.' /> '.$format.'</label><br>';
}
echo $output;
}

function volcano_custom_header() {
$options = get_option( 'custom_header' );
$checked = ( @$options == 1 ? 'checked' : '' );
echo '<label><input type="checkbox" id="custom_header" name="custom_header" value="1" '.$checked.' /> Activate the Custom Header</label>';
}

function volcano_custom_background() {
$options = get_option( 'custom_background' );
$checked = ( @$options == 1 ? 'checked' : '' );
echo '<label><input type="checkbox" id="custom_background" name="custom_background" value="1" '.$checked.' /> Activate the Custom Background</label>';
}

// Sidebar Options Functions
function volcano_sidebar_options() {
echo 'Customize your Sidebar Information';
}

function volcano_sidebar_profile() {
$picture = esc_attr( get_option( 'profile_picture' ) );
if( empty($picture) ){
echo '<input type="button" class="button button-secondary" value="Upload Profile Picture" id="upload-button"><input type="hidden" id="profile-picture" name="profile_picture" value="" />';
} else {
echo '<input type="button" class="button button-secondary" value="Replace Profile Picture" id="upload-button"><input type="hidden" id="profile-picture" name="profile_picture" value="'.$picture.'" /> <input type="button" class="button button-secondary" value="Remove" id="remove-picture">';
}

}
function volcano_sidebar_name() {
$firstName = esc_attr( get_option( 'first_name' ) );
$lastName = esc_attr( get_option( 'last_name' ) );
echo '<input type="text" name="first_name" value="'.$firstName.'" placeholder="First Name" /> <input type="text" name="last_name" value="'.$lastName.'" placeholder="Last Name" />';
}
function volcano_sidebar_description() {
$description = esc_attr( get_option( 'user_description' ) );
echo '<input type="text" name="user_description" value="'.$description.'" placeholder="Description" /><p class="description">Write something smart.</p>';
}
function volcano_sidebar_twitter() {
$twitter = esc_attr( get_option( 'twitter_handler' ) );
echo '<input type="text" name="twitter_handler" value="'.$twitter.'" placeholder="Twitter handler" /><p class="description">Input your Twitter username without the @ character.</p>';
}
function volcano_sidebar_facebook() {
$facebook = esc_attr( get_option( 'facebook_handler' ) );
echo '<input type="text" name="facebook_handler" value="'.$facebook.'" placeholder="Facebook handler" />';
}
function volcano_sidebar_gplus() {
$gplus = esc_attr( get_option( 'gplus_handler' ) );
echo '<input type="text" name="gplus_handler" value="'.$gplus.'" placeholder="Google+ handler" />';
}

//Sanitization settings
function volcano_sanitize_twitter_handler( $input ){
$output = sanitize_text_field( $input );
$output = str_replace('@', '', $output);
return $output;
}

//Template submenu functions
function volcano_theme_create_page() {
require_once( get_template_directory() . '/inc/templates/volcano-admin.php' );
}

function volcano_theme_support_page() {
require_once( get_template_directory() . '/inc/templates/volcano-theme-support.php' );
}
function volcano_theme_settings_page() {

echo '<h1>volcano Custom CSS</h1>';

}

}

最佳答案

右花括号 } 错位到函数 volcano_theme_options() 的底部。检查并修复该问题。

关于javascript - 解析错误 : syntax error, 文件意外结尾 WordPress 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35055194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com