Parse error: syntax error, unexpected end of file wordpress theme
本问题已经有最佳答案,请猛点这里访问。
错误:解析错误:语法错误,/Applications/MAMP/htdocs/volcano/wp-content/themes/volcano_1.01/inc/function-admin.php中第144行的文件意外结束我一直在使用WordPress主题 。 我目前在工作
管理面板。 我在MAMP服务器上的测试环境中使用它。 我做错事情了。 如果有人可以查看一下,那将非常有帮助。 谢谢!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | <?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>'; } 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 'volcano Custom CSS'; } } |
函数