'; } endif; /*フッターメニュー*/ if ( ! function_exists( 'neatly_credit_menu' ) ) : function neatly_credit_menu(){ echo ''; } endif; /*ヘッダーウィジェット*/ if ( ! function_exists( 'neatly_header_widget' ) ) : function neatly_header_widget(){ echo '
'; dynamic_sidebar('header_widget'); echo '
'; } endif; if ( ! function_exists( 'neatly_header_logo_title' ) ) : function neatly_header_logo_title () { if ( has_custom_logo() ) { $custom_logo_id = get_theme_mod( 'custom_logo' ); $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' ); echo ''; } else { echo '

'.get_bloginfo( 'name' , 'display' ).'

'; } } endif; if ( ! function_exists( 'neatly_header_logo_icon' ) ) : function neatly_header_logo_icon () { $header_icon = get_theme_mod( 'neatly_header_icon',''); if($header_icon !== '' ){ $header_icon_size = wp_get_attachment_metadata( attachment_url_to_postid($header_icon) ); echo '' . get_bloginfo( 'name' , 'display' ) . ''; } } endif; /*時差*/ if ( ! function_exists( 'neatly_human_time_diff' ) ) : function neatly_human_time_diff($time) { $tzstring = get_option( 'timezone_string' ); $offset = get_option( 'gmt_offset' ); //Manual offset... //@see http://us.php.net/manual/en/timezones.others.php //@see https://bugs.php.net/bug.php?id=45543 //@see https://bugs.php.net/bug.php?id=45528 //IANA timezone database that provides PHP's timezone support uses POSIX (i.e. reversed) style signs if( empty( $tzstring ) && 0 != $offset && floor( $offset ) == $offset ){ $offset_st = $offset > 0 ? "-$offset" : '+'.absint( $offset ); $tzstring = 'Etc/GMT'.$offset_st; } //Issue with the timezone selected, set to 'UTC' if( empty( $tzstring ) ){ $tzstring = 'UTC'; } $now = new DateTime('', new DateTimeZone( $tzstring ) ); $interval = $now->diff(new DateTime($time, new DateTimeZone( $tzstring ) )); //if ($interval->invert == 0) return __('just now','neatly');//'just now'; if ($interval->y == 1) return __('a year ago','neatly'); /* translators: %s: years */ if ($interval->y > 1) return sprintf( __( '%s years ago' , 'neatly' ), $interval->format('%y') ); if ($interval->m == 1) return __('a month ago','neatly'); /* translators: %s: months */ if ($interval->m > 1) return sprintf( __( '%s months ago' , 'neatly' ), $interval->format('%m') ); /* translators: %s: week */ if ($interval->d > 13) return sprintf( __('%s weeks ago','neatly'), intval($interval->d / 7) ); if ($interval->d == 7) return __('a week ago','neatly'); /* translators: %s: time */ if ($interval->d == 1) return sprintf( __('yesterday at %s','neatly'), get_post_time('h:i a') ); /* translators: %s: date */ if ($interval->d > 1) return sprintf( __( '%s days ago' , 'neatly' ), $interval->format('%d') ); if ($interval->h == 1) return __('an hour ago','neatly'); /* translators: %s: hour */ if ($interval->h > 1) return sprintf( __( '%s hours ago' , 'neatly' ), $interval->format('%h') ); if ($interval->i == 1) return __('a minute ago','neatly'); /* translators: %s: minute */ if ($interval->i > 1) return sprintf( __( '%s minutes ago' , 'neatly' ), $interval->format('%i') ); return __('just now','neatly');//$interval->format('just now'); } endif; if ( ! function_exists( 'neatly_get_thumbnail' ) ) : function neatly_get_thumbnail($post_id = '' , $size = 'thumbnail') { /* * @param string $post_id Post ID. * @param string $size thumbnail, middle ,large etc. */ $thumbnail = array(); if( has_post_thumbnail($post_id) ) {/*サムネイルがある場合*/ /*配列で返す*/ $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post_id) , $size ); $thumbnail['has_image'] = true; return $thumbnail; }else{ preg_match("/]+src=[\"'](s?https?:\/\/[\-_\.!~\*'()a-z0-9;\/\?:@&=\+\$,%#]+\.(jpg|jpeg|png|gif))[\"'][^>]+>/i", get_post($post_id)->post_content, $thumurl); if(isset($thumurl[1])){ $img_id = attachment_url_to_postid($thumurl[1]); $img_data = wp_get_attachment_metadata ($img_id); /*サイト内の画像であれば*/ if(!empty($img_data) ){ $thumbnail[0] = $thumurl[1]; $thumbnail[1] = $img_data['width']; $thumbnail[2] = $img_data['height']; $thumbnail['has_image'] = true; return $thumbnail; } } } $thumbnail[0] = $thumbnail[1] = $thumbnail[2] = ''; $thumbnail['has_image'] = false; return $thumbnail; } endif; if ( ! function_exists( 'neatly_comment_author_anchor' ) ) : function neatly_comment_author_anchor( $author_link ){ return str_replace( "comment_type ) : case 'pingback': case 'trackback': ?>
  • ', '' ); ?>

  • >
    comment_author_email, 60 ); ?>
    ' '.__('Reply', 'neatly'),'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> '.__('Edit', 'neatly'),' ','') ?>
    comment_approved == '0') : ?>
    array_search($key2, $order)); }); } return $fields; } add_filter( 'comment_form_fields', 'neatly_move_comment_field_to_bottom' ); if ( ! function_exists( 'wp_body_open' ) ) : /** * Fire the wp_body_open action. * * Added for backwards compatibility to support pre 5.2.0 WordPress versions. */ function wp_body_open() { /** * Triggered after the opening tag. */ do_action( 'wp_body_open' ); } endif; if ( ! function_exists( 'neatly_the_posts_pagination' ) ) : function neatly_the_posts_pagination( $args = array() ) { $navigation = ''; // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { $args = wp_parse_args( $args, array( 'mid_size' => 1, 'prev_text' => '<', 'next_text' => '>', 'screen_reader_text' => __( 'Posts navigation' , 'neatly' ), ) ); $args['type'] = 'list'; // Set up paginated links. $links = paginate_links( $args ); if ( $links ) { $links = preg_replace(array( '{