diff --git a/functions.php b/functions.php index 54a05c4..f212159 100644 --- a/functions.php +++ b/functions.php @@ -233,6 +233,7 @@ require get_template_directory() . '/inc/categories-images.php'; //Comment Location Start function convertip($ip) { + error_reporting(E_ALL ^ E_NOTICE); $dat_path = dirname(__FILE__).'/inc/QQWry.Dat'; if(!$fd = @fopen($dat_path, 'rb')){ return 'IP date file not exists or access denied'; @@ -468,7 +469,7 @@ function set_post_views() { $post_id = intval($post->ID); $count_key = 'views'; $views = get_post_custom($post_id); - $views = intval($views['views'][0]); + $views = array_key_exists("views",$views) ? intval($views['views'][0]) : 0; if(is_single() || is_page()) { if(!update_post_meta($post_id, 'views', ($views + 1))) { add_post_meta($post_id, 'views', 1, true); @@ -487,7 +488,7 @@ function get_post_views($post_id) { } else { $count_key = 'views'; $views = get_post_custom($post_id); - $views = intval($views['views'][0]); + $views = array_key_exists("views",$views) ? intval($views['views'][0]) : 0; $post_views = intval(post_custom('views')); if($views == '') { return 0; @@ -1286,7 +1287,7 @@ function memory_archives_list() { /* Remove the "Dashboard" from the admin menu for non-admin users */ function remove_dashboard () { global $current_user, $menu, $submenu; - get_currentuserinfo(); + wp_get_current_user(); if( ! in_array( 'administrator', $current_user->roles ) ) { reset( $menu ); @@ -1603,13 +1604,17 @@ function output_comments_qq_columns( $column_name, $comment_id ){ */ add_filter( 'get_avatar', 'change_avatar', 10, 3 ); function change_avatar($avatar){ - global $comment; - if( get_comment_meta( $comment->comment_ID, 'new_field_qq', true ) ){ - $qq_number = get_comment_meta( $comment->comment_ID, 'new_field_qq', true ); - return ''; - }else{ - return $avatar ; - } + global $comment; + if ($comment) { + if( get_comment_meta( $comment->comment_ID, 'new_field_qq', true )){ + $qq_number = get_comment_meta( $comment->comment_ID, 'new_field_qq', true ); + return ''; + }else{ + return $avatar ; + } + } else{ + return $avatar ; + } } // default feature image diff --git a/inc/theme_plus.php b/inc/theme_plus.php index afd4490..c554094 100644 --- a/inc/theme_plus.php +++ b/inc/theme_plus.php @@ -260,7 +260,7 @@ function Exuser_center(){ ?> // 登录成功 function login_ok(){ global $current_user; - get_currentuserinfo(); + wp_get_current_user(); ?>
display_name; ?>
@@ -464,7 +464,7 @@ function the_video_headPattern_normal(){ * 导航栏用户菜单 */ function header_user_menu(){ - global $current_user;get_currentuserinfo(); + global $current_user;wp_get_current_user(); if(is_user_logged_in()){ $ava = akina_option('focus_logo') ? akina_option('focus_logo') : get_avatar_url( $current_user->user_email ); ?> @@ -510,7 +510,9 @@ function header_user_menu(){ // 上一篇 function get_prev_thumbnail_url() { $prev_post = get_previous_post(); - if ( has_post_thumbnail($prev_post->ID) ) { + if (!$prev_post) { + return get_random_bg_url(); // 首页图 + } else if ( has_post_thumbnail($prev_post->ID) ) { $img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $prev_post->ID ), 'large'); return $img_src[0]; // 特色图 }