{"id":11724,"date":"2016-08-29T22:28:05","date_gmt":"2016-08-29T13:28:05","guid":{"rendered":"http:\/\/koro-rd.ddo.jp\/wblog\/?p=11724"},"modified":"2016-08-30T13:26:23","modified_gmt":"2016-08-30T04:26:23","slug":"%e3%82%ab%e3%83%ac%e3%83%b3%e3%83%80%e3%83%bc","status":"publish","type":"post","link":"https:\/\/koro-rd.ddo.jp\/wblog\/archives\/11724","title":{"rendered":"\u30ab\u30ec\u30f3\u30c0\u30fc\u306b\u30bf\u30a4\u30c8\u30eb\u3092\uff01"},"content":{"rendered":"<p>\u306a\u3093\u304b\u524d\u306f\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u8a18\u4e8b\u306e\u3042\u308b\u65e5\u4ed8\u306b\u30de\u30a6\u30b9\u30aa\u30fc\u30d0\u30fc\u3059\u308b\u3068\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3067\u305d\u306e\u65e5\u306b\u66f8\u3044\u305f\u8a18\u4e8b\u4e00\u89a7\u304c\u51fa\u3066\u3044\u305f\u3088\u3046\u306a\uff1f<br \/>\n\u4eca\u306f\u305d\u3046\u306a\u3063\u3066\u306a\u3044\u3002<br \/>\n\u3044\u3064\u4f55\u3092\u66f8\u3044\u305f\u306e\u304b\u3059\u3050\u308f\u304b\u3063\u3066\u4fbf\u5229\u3060\u3063\u305f\u306e\u306b\u3002<\/p>\n<p>\u3069\u3046\u306b\u304b\u306a\u3089\u306a\u3044\u304b\u8abf\u3079\u3066\u307f\u305f\u304c\u3001\u3069\u3046\u3082\u691c\u7d22\u30ef\u30fc\u30c9\u304c\u60aa\u3044\u306e\u304b\u51fa\u3066\u3053\u306a\u3044\u3002<br \/>\n\u4e00\u4f53\u3042\u306e\u4fbf\u5229\u306a\u6a5f\u80fd\u306f\u3069\u3053\u3078\u884c\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3042\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u306a\u3093\u304b\u8abf\u3079\u308b\u3068general-template.php \u306eget_calender\u306e\u95a2\u6570\u304c\u5168\u7136\u9055\u3046\u3093\u3060\u3051\u3069\u3082\u3002<br \/>\n\u3046\u307e\u3044\u3053\u3068\u30de\u30fc\u30b8\u3059\u308c\u3070\u3044\u3051\u308b\u306e\u304b\u3082\u3057\u308c\u3093\u304c\u3002\u3002\u3002<br \/>\n\u306a\u3093\u3067\u3053\u3093\u306a\u306b\u9055\u3046\u3067\u3059\u304b\u306d\u3002<\/p>\n<p>\u3042\u3042\u3001\u30de\u30fc\u30b8\u3057\u305f\u3089\u3044\u3051\u307e\u3057\u305f\u308f\u3002<\/p>\n<p><a href=\"https:\/\/koro-rd.ddo.jp\/wblog\/wp-content\/uploads\/2016\/08\/photo080-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/koro-rd.ddo.jp\/wblog\/wp-content\/uploads\/2016\/08\/photo080-1-400x267.jpg\" alt=\"photo080\" width=\"400\" height=\"267\" class=\"alignnone size-large wp-image-11730\" srcset=\"https:\/\/koro-rd.ddo.jp\/wblog\/wp-content\/uploads\/2016\/08\/photo080-1-400x267.jpg 400w, https:\/\/koro-rd.ddo.jp\/wblog\/wp-content\/uploads\/2016\/08\/photo080-1-200x134.jpg 200w, https:\/\/koro-rd.ddo.jp\/wblog\/wp-content\/uploads\/2016\/08\/photo080-1.jpg 600w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><br \/>\n\u4ee5\u4e0b\u5909\u66f4\u3001\u8ffd\u52a0\u3057\u305f\u30b3\u30fc\u30c9<\/p>\n<div id='Link11724' class='ajax-entry-more-link'><a href='https:\/\/koro-rd.ddo.jp\/wblog\/archives\/11724' name='ext11724' onclick=\"ajaxShowHide(11724);return false;\">\u7d9a\u304d\u3092\u8aad\u3080 &#187;<\/a><\/div>\n<div id='Text11724' style='display: none'>\n<p><code><\/p>\n<p>function calendar_week_mod_me($num) {<br \/>\n\t$base = 7;<br \/>\n\treturn ($num - $base*floor($num\/$base));<br \/>\n}<\/p>\n<p>add_filter('get_calendar', 'my_calendar');<\/p>\n<p>function my_calendar($initial = true, $echo = true) {<br \/>\n\tglobal $wpdb, $m, $monthnum, $year, $wp_locale, $posts;<\/p>\n<p>\t\/\/ week_begins = 0 stands for Sunday<br \/>\n\t$week_begins = (int) get_option( 'start_of_week' );<br \/>\n\t$ts = current_time( 'timestamp' );<\/p>\n<p>\t\/\/ Let's figure out when we are<br \/>\n\tif ( ! empty( $monthnum ) &amp;&amp; ! empty( $year ) ) {<br \/>\n\t\t$thismonth = zeroise( intval( $monthnum ), 2 );<br \/>\n\t\t$thisyear = (int) $year;<br \/>\n\t} elseif ( ! empty( $w ) ) {<br \/>\n\t\t\/\/ We need to get the month from MySQL<br \/>\n\t\t$thisyear = (int) substr( $m, 0, 4 );<br \/>\n\t\t\/\/it seems MySQL's weeks disagree with PHP's<br \/>\n\t\t$d = ( ( $w - 1 ) * 7 ) + 6;<br \/>\n\t\t$thismonth = $wpdb-&gt;get_var(\"SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')\");<br \/>\n\t} elseif ( ! empty( $m ) ) {<br \/>\n\t\t$thisyear = (int) substr( $m, 0, 4 );<br \/>\n\t\tif ( strlen( $m ) &lt; 6 ) {<br \/>\n\t\t\t$thismonth = '01';<br \/>\n\t\t} else {<br \/>\n\t\t\t$thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );<br \/>\n\t\t}<br \/>\n\t} else {<br \/>\n\t\t$thisyear = gmdate( 'Y', $ts );<br \/>\n\t\t$thismonth = gmdate( 'm', $ts );<br \/>\n\t}<\/p>\n<p>\t$unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear );<br \/>\n\t$last_day = date( 't', $unixmonth );<\/p>\n<p>\t\/\/ Get the next and previous month and year with at least one post<br \/>\n\t$previous = $wpdb-&gt;get_row(\"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year<br \/>\n\t\tFROM $wpdb-&gt;posts<br \/>\n\t\tWHERE post_date &lt; '$thisyear-$thismonth-01'<br \/>\n\t\tAND post_type = 'post' AND post_status = 'publish'<br \/>\n\t\t\tORDER BY post_date DESC<br \/>\n\t\t\tLIMIT 1\");<br \/>\n\t$next = $wpdb-&gt;get_row(\"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year<br \/>\n\t\tFROM $wpdb-&gt;posts<br \/>\n\t\tWHERE post_date &gt; '$thisyear-$thismonth-{$last_day} 23:59:59'<br \/>\n\t\tAND post_type = 'post' AND post_status = 'publish'<br \/>\n\t\t\tORDER BY post_date ASC<br \/>\n\t\t\tLIMIT 1\");<\/p>\n<p>\t\/* translators: Calendar caption: 1: month name, 2: 4-digit year *\/<br \/>\n\t$calendar_caption = _x('%1$s %2$s', 'calendar caption');<br \/>\n\t$calendar_output = '&lt;table id=\"wp-calendar\"&gt;<br \/>\n\t&lt;caption&gt;' . sprintf(<br \/>\n\t\t$calendar_caption,<br \/>\n\t\t$wp_locale-&gt;get_month( $thismonth ),<br \/>\n\t\tdate( 'Y', $unixmonth )<br \/>\n\t) . '&lt;\/caption&gt;<br \/>\n\t&lt;thead&gt;<br \/>\n\t&lt;tr&gt;';<\/p>\n<p>\t$myweek = array();<\/p>\n<p>\tfor ( $wdcount = 0; $wdcount &lt;= 6; $wdcount++ ) {<br \/>\n\t\t$myweek[] = $wp_locale-&gt;get_weekday( ( $wdcount + $week_begins ) % 7 );<br \/>\n\t}<\/p>\n<p>\tforeach ( $myweek as $wd ) {<br \/>\n\t\t$day_name = $initial ? $wp_locale-&gt;get_weekday_initial( $wd ) : $wp_locale-&gt;get_weekday_abbrev( $wd );<br \/>\n\t\t$wd = esc_attr( $wd );<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t&lt;th scope=\\\"col\\\" title=\\\"$wd\\\"&gt;$day_name&lt;\/th&gt;\";<br \/>\n\t}<\/p>\n<p>\t$calendar_output .= '<br \/>\n\t&lt;\/tr&gt;<br \/>\n\t&lt;\/thead&gt;<\/p>\n<p>\t&lt;tfoot&gt;<br \/>\n\t&lt;tr&gt;';<\/p>\n<p>\tif ( $previous ) {<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t\".'&lt;td colspan=\"3\" id=\"prev\"&gt;&lt;a href=\"' . get_month_link( $previous-&gt;year, $previous-&gt;month ) . '\"&gt;&amp;laquo; ' .<br \/>\n\t\t\t$wp_locale-&gt;get_month_abbrev( $wp_locale-&gt;get_month( $previous-&gt;month ) ) .<br \/>\n\t\t'&lt;\/a&gt;&lt;\/td&gt;';<br \/>\n\t} else {<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t\".'&lt;td colspan=\"3\" id=\"prev\" class=\"pad\"&gt;&amp;nbsp;&lt;\/td&gt;';<br \/>\n\t}<\/p>\n<p>\t$calendar_output .= \"\\n\\t\\t\".'&lt;td class=\"pad\"&gt;&amp;nbsp;&lt;\/td&gt;';<\/p>\n<p>\tif ( $next ) {<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t\".'&lt;td colspan=\"3\" id=\"next\"&gt;&lt;a href=\"' . get_month_link( $next-&gt;year, $next-&gt;month ) . '\"&gt;' .<br \/>\n\t\t\t$wp_locale-&gt;get_month_abbrev( $wp_locale-&gt;get_month( $next-&gt;month ) ) .<br \/>\n\t\t' &amp;raquo;&lt;\/a&gt;&lt;\/td&gt;';<br \/>\n\t} else {<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t\".'&lt;td colspan=\"3\" id=\"next\" class=\"pad\"&gt;&amp;nbsp;&lt;\/td&gt;';<br \/>\n\t}<\/p>\n<p>\t$calendar_output .= '<br \/>\n\t&lt;\/tr&gt;<br \/>\n\t&lt;\/tfoot&gt;<\/p>\n<p>\t&lt;tbody&gt;<br \/>\n\t&lt;tr&gt;';<\/p>\n<p>\t$daywithpost = array();<\/p>\n<p>\t\/\/ Get days with posts<br \/>\n\t$dayswithposts = $wpdb-&gt;get_results(\"SELECT DISTINCT DAYOFMONTH(post_date)<br \/>\n\t\tFROM $wpdb-&gt;posts WHERE post_date &gt;= '{$thisyear}-{$thismonth}-01 00:00:00'<br \/>\n\t\tAND post_type = 'post' AND post_status = 'publish'<br \/>\n\t\tAND post_date &lt;= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'\", ARRAY_N);<br \/>\n\tif ( $dayswithposts ) {<br \/>\n\t\tforeach ( (array) $dayswithposts as $daywith ) {<br \/>\n\t\t\t$daywithpost[] = $daywith[0];<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>\tif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false)<br \/>\n\t\t$ak_title_separator = \"\\n\";<br \/>\n\telse<br \/>\n\t\t$ak_title_separator = ', ';<\/p>\n<p>\t$ak_titles_for_day = array();<br \/>\n\t$ak_post_titles = $wpdb-&gt;get_results(\"SELECT ID, post_title, DAYOFMONTH(post_date) as dom \"<br \/>\n\t\t.\"FROM $wpdb-&gt;posts \"<br \/>\n\t\t.\"WHERE post_date &gt;= '{$thisyear}-{$thismonth}-01 00:00:00' \"<br \/>\n\t\t.\"AND post_date &lt;= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' \"<br \/>\n\t\t.\"AND post_type = 'post' AND post_status = 'publish'\"<br \/>\n\t);<br \/>\n\tif ( $ak_post_titles ) {<br \/>\n\t\tforeach ( (array) $ak_post_titles as $ak_post_title ) {<\/p>\n<p>\t\t\t\t\/** This filter is documented in wp-includes\/post-template.php *\/<br \/>\n\t\t\t\t$post_title = esc_attr( apply_filters( 'the_title', $ak_post_title-&gt;post_title, $ak_post_title-&gt;ID ) );<\/p>\n<p>\t\t\t\tif ( empty($ak_titles_for_day['day_'.$ak_post_title-&gt;dom]) )<br \/>\n\t\t\t\t\t$ak_titles_for_day['day_'.$ak_post_title-&gt;dom] = '';<br \/>\n\t\t\t\tif ( empty($ak_titles_for_day[\"$ak_post_title-&gt;dom\"]) ) \/\/ first one<br \/>\n\t\t\t\t\t$ak_titles_for_day[\"$ak_post_title-&gt;dom\"] = $post_title;<br \/>\n\t\t\t\telse<br \/>\n\t\t\t\t\t$ak_titles_for_day[\"$ak_post_title-&gt;dom\"] .= $ak_title_separator . $post_title;<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>\t\/\/ See how much we should pad in the beginning<br \/>\n\t$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );<br \/>\n\tif ( 0 != $pad ) {<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t\".'&lt;td colspan=\"'. esc_attr( $pad ) .'\" class=\"pad\"&gt;&amp;nbsp;&lt;\/td&gt;';<br \/>\n\t}<\/p>\n<p>\t$newrow = false;<br \/>\n\t$daysinmonth = (int) date( 't', $unixmonth );<\/p>\n<p>\tfor ( $day = 1; $day &lt;= $daysinmonth; ++$day ) {<br \/>\n\t\tif ( isset($newrow) &amp;&amp; $newrow ) {<br \/>\n\t\t\t$calendar_output .= \"\\n\\t&lt;\/tr&gt;\\n\\t&lt;tr&gt;\\n\\t\\t\";<br \/>\n\t\t}<br \/>\n\t\t$newrow = false;<\/p>\n<p>\t\tif ( $day == gmdate( 'j', $ts ) &amp;&amp;<br \/>\n\t\t\t$thismonth == gmdate( 'm', $ts ) &amp;&amp;<br \/>\n\t\t\t$thisyear == gmdate( 'Y', $ts ) ) {<br \/>\n\t\t\t$calendar_output .= '&lt;td id=\"today\"&gt;';<br \/>\n\t\t} else {<br \/>\n\t\t\t$calendar_output .= '&lt;td&gt;';<br \/>\n\t\t}<\/p>\n<p>\t\tif ( in_array( $day, $daywithpost ) ) {<br \/>\n\t\t\t\/\/ any posts today?<br \/>\n\t\t\t$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( \"{$thisyear}-{$thismonth}-{$day}\" ) );<br \/>\n\t\t\t$label = sprintf( __( 'Posts published on %s' ), $date_format );<br \/>\n\t\t\t$calendar_output .= sprintf(<br \/>\n\t\t\t\t'&lt;a href=\"%s\" aria-label=\"%s\" title=\"%s\"&gt;%s&lt;\/a&gt;',<br \/>\n\t\t\t\tget_day_link( $thisyear, $thismonth, $day ),<br \/>\n\t\t\t\tesc_attr( $label ),<br \/>\n\t\t\t\tesc_attr( $ak_titles_for_day[ $day ] ),<br \/>\n\t\t\t\t$day<br \/>\n\t\t\t);<br \/>\n\t\t} else {<br \/>\n\t\t\t$calendar_output .= $day;<br \/>\n\t\t}<br \/>\n\t\t$calendar_output .= '&lt;\/td&gt;';<\/p>\n<p>\t\tif ( 6 == calendar_week_mod( date( 'w', mktime(0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {<br \/>\n\t\t\t$newrow = true;<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>\t$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins );<br \/>\n\tif ( $pad != 0 &amp;&amp; $pad != 7 ) {<br \/>\n\t\t$calendar_output .= \"\\n\\t\\t\".'&lt;td class=\"pad\" colspan=\"'. esc_attr( $pad ) .'\"&gt;&amp;nbsp;&lt;\/td&gt;';<br \/>\n\t}<br \/>\n\t$calendar_output .= \"\\n\\t&lt;\/tr&gt;\\n\\t&lt;\/tbody&gt;\\n\\t&lt;\/table&gt;\";<\/p>\n<p>\techo $calendar_output;<br \/>\n}<\/p>\n<p><\/code><br \/>\n\u3053\u3093\u306a\u306e\u3092functions.php\u306b\u8ffd\u52a0\u3059\u308b\u3068<br \/>\nget_calender\u3092\u8aad\u3093\u3067\u3044\u308b\u3068\u3053\u308d\u306f\u52dd\u624b\u306bmy_calender\u304c\u30e9\u30c3\u30d7\u3055\u308c\u308b\u3093\u3060\u3063\u3066\u3055<br \/>\n\u30b3\u30d4\u30da\u304c\u4e3b\u306a\u306e\u3067\u307e\u3060\u307e\u3060\u3060\u305c<\/p>\n<div class='ajax-entry-more-link'><a href='#ext11724' onclick=\"ajaxShowHide(11724);return false;\">&#171; \u7d9a\u304d\u3092\u96a0\u3059<\/a><\/div>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u306a\u3093\u304b\u524d\u306f\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u8a18\u4e8b\u306e\u3042\u308b\u65e5\u4ed8\u306b\u30de\u30a6\u30b9\u30aa\u30fc\u30d0\u30fc\u3059\u308b\u3068\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3067\u305d\u306e\u65e5\u306b\u66f8\u3044\u305f\u8a18\u4e8b\u4e00\u89a7\u304c\u51fa\u3066\u3044\u305f\u3088\u3046\u306a\uff1f \u4eca\u306f\u305d\u3046\u306a\u3063\u3066\u306a\u3044\u3002 \u3044\u3064\u4f55\u3092\u66f8\u3044\u305f\u306e\u304b\u3059\u3050\u308f\u304b\u3063\u3066\u4fbf\u5229\u3060\u3063\u305f\u306e\u306b\u3002 \u3069\u3046\u306b\u304b\u306a\u3089\u306a\u3044\u304b\u8abf\u3079\u3066\u307f\u305f\u304c\u3001\u3069\u3046 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-11724","post","type-post","status-publish","format-standard","hentry","category-11"],"_links":{"self":[{"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/posts\/11724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/comments?post=11724"}],"version-history":[{"count":0,"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/posts\/11724\/revisions"}],"wp:attachment":[{"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/media?parent=11724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/categories?post=11724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/koro-rd.ddo.jp\/wblog\/wp-json\/wp\/v2\/tags?post=11724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}