@charset "UTF-8";
/*
Theme Name: 「初めてのブログ」のテーマ
Description: 「初めてのブログ」用Cocoon子テーマ
Theme URI: https://wp-cocoon.com/
Author: エンデ・バタロー
Author URI: https://hajimete.org/
Template:   cocoon-master
Version:    1.1.2
*/
header {
	    background-position: center;
    background-attachment: scroll;
}
header .ss-top {
/* 	display: none !important; */
}
.read-time {
/* 	margin: 0 !important; */
}
.article-header .ad-area,
.article-header .magic_tag_129517-1 {
/* 	display: none !important; */
}
#sns_follow_buttons-2 > div:first-child {
	display: none !important;
}
#sns_follow_buttons-2 {
	border-top: 4px double #ddd;
	border-bottom: 4px double #ddd;
}
.entry-title, .archive-title {
	font-size: 32px;
	margin: 15px 0;
	padding: 0 !important;
}
.read-time {
	font-size: 16px;
	padding: 8px 0;
}
.entry-content {
	text-align: left;
}
.breadcrumb, .breadcrumb a, .author-box p a, .navi-footer-in > .menu-footer li.menu-item a {
	color: #515151 !important;
}
.sidebar .magic_tag_129517-3,
.sidebar .magic_tag_129517-20 {
	position: fixed !important;
	top: -4000px !important;
}
#sas_iframe_fixed_26328 {
	position: fixed !important;
	bottom: 10000px !important;
}
.search-submit {
	    height: 44px;
    width: 44px;
    margin-top: -9px;
}
.author-box .author-name a {
	color: #515151;
}
.footer-bottom-logo img {
	height: auto;
}
.sns-share, .sns-follow {
	margin: 24px auto;
	width: 70%;
	min-width: 280px;
}
.sns-share-message, .sns-follow-message {
	margin-bottom: 11px;
}
.sns-follow-buttons a {
	margin-right: 10px;
}
.author-box .sns-follow-buttons a.follow-button {
    font-size: 17px;
    width: 59px;
    height: 31px;
}
.pagination-next-link, .comment-btn {
	font-size:18px;
}
.cat-label {
	    top: 0;
    left: 0;
	font-size: 12px;
	    padding: 2px 9px;
    line-height: 1.7;
}

.code2 {
	    border: 1px solid rgba(0,0,0,.2);
    padding: 0 6px 60px;
    width: 100%;
    margin: 12px auto 0;
    display: block;
}
.widget_recent_entries ul li a {
	padding: 6px 0;
}
.tagline {
	    margin: 83px auto 58px;
    padding: 9px 0;
    text-align: center;
}
ul {
	margin: 0;
	padding: 0;
}
li {
	margin: 0;
	padding: 0;
	list-style: none;
}
p {
	margin: 0;
	line-height: 2;
	letter-spacing: 1.65px;
}
pre {
	margin: 17px auto 23px !important;
	width: 100%;
	padding: 15px 23px !important;
	border-radius: 16px;
}
.header {
  background-image: url(https://hajimete.org/wp-content/uploads/2022/10/top.jpg);
  background-size: 502px auto;
  background-position: center -15px !important;
}
.related-entry-heading, .comment-title {
line-height: 1.35;
}
.header.ba-fixed:before, .appeal.ba-fixed:before {
/* display: none; */
}
.article-footer .amalink {
/* display: none; */
}
.logo-menu-button.menu-button {
	height: 45px;
}
.header, .header .site-name-text, #navi .navi-in a, #navi .navi-in a:hover, .appeal-content .appeal-button, .article h2, .sidebar h2, .sidebar h3, .cat-link, .cat-label, .blogcard-type .blogcard::before, #footer, #footer a{
	color: #4c4c4c
}
.nwa .author-box {
	padding: 0;
}
.nwa .author-box .author-content {
	padding: 0;
}
.nwa .author-box .author-description {
	font-size: 15px;
	margin-bottom: 20px;
}
.eye-catch {
	margin: 24px auto 25px;
	width: 100%;
}
.eye-catch img {
	width: 100%;
	border-radius: 40px;
	overflow: hidden;
	box-shadow: 0 20px 40px -10px rgba(0,0,0,.2);
}
.author-widget-name {
	display: none;
}
.nwa .author-box .author-thumb {
  width: 80%;
  max-width: 132px;
	margin: -10px auto 0;
}
.author-box .author-name {
	font-size: 15px;
	margin-bottom: 18px;
	text-align: center;
}
.author-box .author-name a {
	width: 160px;
	display: block;
	text-align: center;
	margin: 0 auto;
}
.content-in {
position: relative;
}
.sidebar {
    /* position: sticky;
    top: 23px;
    right: 0; */
}
.ad-sidebar-top {
min-height: 280px;
}
.author-box .sns-follow {
	margin: 0 auto !important;
}
.nwa .author-box .sns-follow-buttons {
  justify-content: center;
}
.sns-follow-buttons a span {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
}
.author-description {
	font-size: 16px;
}
.logo-menu-button a {
	position: absolute;
	top: 48%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: block;
	width: 76%;
	max-width: 176px;
}
.logo-menu-button a img {
	display: block;
}
.navi-menu-caption {
	white-space: nowrap;
}
.header {
	background-image: url(https://hajimete.org/wp-content/uploads/2022/10/top.jpg);
  background-size: 502px auto;
  background-position: center top;
}
.logo-image {
	padding: 0;
	font-size: inherit;
	display: inline-block;
	width: 86%;
	max-width: 385px;
	margin: 0 auto;
}
.tagline {
  margin: 28px auto 0 !important;
  padding: 0 !important;
  width: 90%;
  max-width: 400px;
  font-weight: 800;
	display: inline;
  -webit-box-decoration-break: clone;
  box-decoration-break: clone;
	background: #fff;
	line-height: 1.55;
}
.navi-in > ul > li {
	width: calc(100%/5) !important;
}
.hp_banner img {
width: 100%;
}
.header .header-in {
	min-height: 263px;
}
.widget-footer-center ul li {
	border-bottom: 1px solid rgba(0,0,0,.4);
}
.widget-footer-center ul li a {
	padding: 6px 0;
	font-size: 18px;
}
#toc {
	border: 1px solid #00c6b9;
  box-shadow: 0px 18px 26px -39px #00c6b9;
  border-radius: 12px;
  padding: 36px 38px;
  width: 100%;
}
#toc ol, #toc ul {
	padding: 0;
}
#toc .toc-checkbox:checked~.toc-content {
	padding: 20px 0 0;
	will-change: height;
}
#toc .toc-content {
	transition: .2s;
}
#toc .toc-checkbox:checked+.toc-title::after,
#toc .toc-title::after{
	content: "☝";
	font-size: 21px;
  font-weight: 600;
  vertical-align: top;
  margin-top: 5px;
  display: inline-block;
  line-height: 1;
	text-decoration: none;
}
#toc .toc-checkbox:checked+.toc-title::after {
	content: "👆";
}
#toc .toc-title::after {
	content: "👇";
}
#toc .toc-checkbox:checked+.toc-title::after:hover,
#toc .toc-title::after:hover {
	text-decoration: none;
	transform: scale(.98);
}
.make-hp {
border: 1px solid #ccc;
padding: 13px 19px 20px;
border-radius: 4px;
}
.make-hp p {
font-size: 15px;
text-align: left;
line-height: 1.4;
margin: 0 0 13px;
letter-spacing: 0;
}
.make-hp a {
display: block;
width: 100%;
line-height: 1.35;
letter-spacing: 0;
padding: 8px;
text-align: center;
margin-bottom: 13px;
font-size: 16px;
border: 1px solid #00d1b5;
border-radius: 4px;
text-decoration: none;
transition: .2s;
}
.make-hp a:hover {
color: #fff;
background: #00d1b5;
}
.make-hp a:last-child {
margin-bottom: 0;
}
@media(max-width: 1023px) {
	.ba-fixed.header {
		display: none !important;
	}
	.tagline {
		display: none !important;
	}
}
@media(max-width: 834px) {
	.article h1 {
		margin: 0;
		font-size: 24px;
	}
	.eye-catch {
		margin: 19px auto 16px;
	}
	.eye-catch img {
		border-radius: 16px;
		box-shadow: 0 13px 23px -13px rgba(0,0,0,.2);
	}
	.author-box.border-element.no-icon.cf {
		margin: 0;
		padding: 0;
	}
	.author-box .author-name {
		margin-bottom: 21px;
	}
	.author-box .author-name a {
		width: 100%;
	}
	.ss-top .sns-share-buttons a, .ss-bottom .sns-share-buttons a {
		font-size: 18px;
	}
	.author-box .sns-follow-buttons a.follow-button {
		width: calc(96% / 4) !important;
		margin: 0;
		height: 42px !important;
		font-size: 22px !important;
	}
	.author-box .sns-follow-buttons {
		justify-content: space-between;
	}
	.author-box.border-element.no-icon.cf .author-thumb.circle-image {
		margin: 0;
		padding: 0;
	}
	.author-box .author-content {
		margin: 0 !important;
	}
	.sns-share, .sns-follow {
		width: 100% !important;
	}
	.ss-top .sns-share-buttons a .button-caption, .ss-bottom .sns-share-buttons a .button-caption {
		display: none;
	}
}
.ect-vertical-card .entry-card-wrap .entry-card-content .google-auto-placed {
width: 100% !important;
height: 0 !important;
overflow: hidden !important;
}
#list > .ad-area {
display: none !important;
}


/* 箱庭タウンず フッターバナー */
.foot-banner {
  padding: 48px 0 67px;
  margin-bottom: -40px;
  text-align: center;
  background: rgba(0,0,0,.2);
}
.foot-banner .ad-area {
  margin: 21px auto 0 !important;
}
.foot-banner__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px 4%;
  width: 94%;
  max-width: 630px;
  margin: 0 auto;
}
.foot-banner__inner > a {
  width: 48%;
  font-size: 0;
  display: block;
}
.foot-banner__inner > a img {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 23px -7px rgba(0,0,0,.3);
}

@media (max-width: 500px) {
  .foot-banner__inner {
    width: 88%;
    max-width: 320px;
  }
  .foot-banner__inner > a {
    width: 100%;
  }
}


/* サブメニュー */
#menu-item-2493 .sub-menu {
  width: 360px !important;
  right: 0;
}
#menu-item-2493 .sub-menu li {
  width: 100% !important;
  height: auto !important;
}
#menu-item-2493 .sub-menu li a {
  transition: .2s;
}
#menu-item-2493 .sub-menu li a:has(:hover):hover {
  opacity: .6;
}
#menu-item-2493 .sub-menu li a img {
  border-radius: 10px;
  overflow: hidden;
}
.menu-drawer .sub-menu {
  padding: 0;
  width: 100%;
  margin: 0 auto;
}
.menu-drawer .sub-menu li a img {
  border-radius: 10px;
  overflow: hidden;
}

/* 広告css */
.add01 {
width: 86%;
max-width: 600px;
margin: 0 auto 9px;
}
.add01 > img {
display: none;
}
.add01 a img {
display: block;
}
.add02 {
width: 100%;
max-width: 468px;
margin: 0 auto 20px;
}
.add02 > img {
display: none;
}
.add02 a img {
display: block;
}

/* サイドバータイトル非表示 */
#sidebar aside h3 {
display: none;
}
#sidebar #search-2 {
margin: 0;
}
#sidebar a {
cursor: pointer;
}
#sidebar .search-box {
margin: 12px auto 14px;
}
#sidebar .search-box input {
	font-size: 16px;
}
#sidebar .search-box input:hover {
border: 1px solid #00d1b5;
}
#sidebar .search-box input:focus {
border: 1px solid #00d1b5;
outline: none;
background: #f9fffe;
}
#sidebar .search-box .fa-search:before {
color: #00d1b5;
}
.side_bnr a {
display: block;
margin: 0 0 12px;
text-decoration: none;
font-size: 16px;
text-align: center;
	width: 100%;
	line-height: 1.3;
	padding: 12px 12px;
	border: 1px solid #00d1b5;
	border-radius: 4px;
	transition: .2s;
}
.side_bnr a:hover {
color: #fff;
background: #00d1b5;
}

/* コメントエリア */
#comment-area .comment-author {
font-size: 16px;
}
#comment-area .comment-meta {
font-size: 14px;
}
#comment-area .comment-content {
    padding: 18px 0 8px;
    border-bottom: 1px solid rgba(0, 0, 0, .2);
    /* margin: 0 0 24px; */
}
#comment-area .comment-content p {
font-size: 15px;
line-height: 1.45;
}
#comment-area .reply {
display: none;
}
#comment-area .comment-body {
margin-bottom: 0;
padding-top: 24px;
}
#comment-area .commets-list .children {
padding-left: 29px;
}


/* その他リンクへのリスト表示 start */
.hakoniwa > img {
  max-width: 363px !important;
  margin: 0 auto !important;
  display: block !important;
  height: auto;
}

.towns_list {
  width: 100%;
  margin: 0 auto -2px;
  padding: 22px 6% 25px;
  overflow-x: scroll;
  overflow-y: auto;
}
.towns_list::-webkit-scrollbar {
  display: none;
}
.towns_list * {
  transition: 0.3s;
  box-sizing: border-box;
}
.towns_list ul {
  display: flex;
  justify-content: center;
  gap: 0 6px;
  width: 100%;
  min-width: 554px;
  margin: 0;
  padding: 0;
}
.towns_list ul::-webkit-scrollbar {
  display: none !important;
}
.towns_list ul li {
  width: 106px;
  margin: 0;
}
.towns_list ul li a {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none !important;
  border-radius: 10px;
  border: 2px solid #3e9fcc;
  padding: 10px 10px 11px 10px;
  height: 39px;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  box-shadow: 1px 1px 1px rgb(255, 255, 255) inset, 0px 7px 18px -8px rgba(0, 24, 66, 0.4);
  background: rgba(255, 255, 255, 0.8);
  transition: 0.4s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: transfrom;
}
.towns_list ul li > a > div {
display: none !important;
}
.magic_tag_129517-31 {
position: fixed !important;
top: -4000px !important;
}
.towns_list ul li a:hover {
  transform: scale(1.03);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 1px 1px 1px rgb(255, 255, 255) inset, 0px 0px 27px -8px rgba(255, 255, 255, 0.9);
}
.towns_list ul li a img {
  width: auto;
  max-width: none;
  height: 14px;
  display: block;
  opacity: 0.85;
}
.towns_list ul li a p {
  font-size: 15px;
  letter-spacing: 0.07em;
  line-height: 1;
  text-shadow: none;
  font-weight: 900;
  color: #155097;
  margin: 0;
  text-shadow: -1px 0 4px rgba(255, 255, 255, 0.3);
	white-space: nowrap;
}

@media (max-width: 442px) {
  .hakoniwa {
    padding-top: 31px !important;
  }
  .towns_list {
    padding: 6% 6% 5%;
  }
  .towns_list ul {
    min-width: 595px;
    gap: 0 5px;
  }
  .towns_list ul li {
    width: 95px;
  }
  .towns_list ul li a {
    height: 35px;
    padding: 8px 9px 9px 10px;
    border-radius: 7px;
    box-shadow: 1px 1px 1px rgb(255, 255, 255) inset;
  }
  .towns_list ul li a:hover {
    transform: scale(1);
    box-shadow: 1px 1px 1px rgb(255, 255, 255) inset;
    background: rgba(255, 255, 255, 0.8);
  }
  .towns_list ul li a img {
    height: 13px;
  }
  .towns_list ul li a p {
    font-size: 14px;
  }
	body>.slideshow {
	display: none;
	}
}
/* その他リンクへのリスト表示 end */







/* 中国からのアクセスをブロックするためのIP範囲チェック */
function block_china_ips() {
    /* 提供されたIP範囲リスト（重複除外済み） */
    $blocked_ranges = [
        '1.0.1.0/24', '1.0.2.0/23', '1.0.4.0/22', '1.0.8.0/21', '1.0.16.0/20', '1.0.32.0/19', '1.0.64.0/18', '1.0.128.0/17',
        '1.1.0.0/16', '1.2.0.0/15', '1.4.0.0/14', '1.8.0.0/13', '1.16.0.0/12', '1.32.0.0/11', '1.64.0.0/10', '1.128.0.0/9',
        '2.0.0.0/8', '2.16.0.0/12', '2.32.0.0/11', '2.64.0.0/10', '2.128.0.0/9', '14.0.0.0/8', '14.16.0.0/12', '14.32.0.0/11',
        '14.64.0.0/10', '14.128.0.0/9', '27.0.0.0/8', '27.16.0.0/12', '27.32.0.0/11', '27.64.0.0/10', '27.128.0.0/9', '36.0.0.0/8',
        '36.16.0.0/12', '36.32.0.0/11', '36.64.0.0/10', '36.128.0.0/9', '39.0.0.0/8', '39.16.0.0/12', '39.32.0.0/11', '39.64.0.0/10',
        '39.128.0.0/9', '42.0.0.0/8', '42.16.0.0/12', '42.32.0.0/11', '42.64.0.0/10', '42.128.0.0/9', '49.0.0.0/8', '49.16.0.0/12',
        '49.32.0.0/11', '49.64.0.0/10', '49.128.0.0/9', '58.0.0.0/8', '58.16.0.0/12', '58.32.0.0/11', '58.64.0.0/10', '58.128.0.0/9',
        '60.0.0.0/8', '60.16.0.0/12', '60.32.0.0/11', '60.64.0.0/10', '60.128.0.0/9', '61.0.0.0/8', '61.16.0.0/12', '61.32.0.0/11',
        '61.64.0.0/10', '61.128.0.0/9', '101.0.0.0/8', '101.16.0.0/12', '101.32.0.0/11', '101.64.0.0/10', '101.128.0.0/9', '103.0.0.0/8',
        '103.16.0.0/12', '103.32.0.0/11', '103.64.0.0/10', '103.128.0.0/9', '106.0.0.0/8', '106.16.0.0/12', '106.32.0.0/11', '106.64.0.0/10',
        '106.128.0.0/9', '110.0.0.0/8', '110.16.0.0/12', '110.32.0.0/11', '110.64.0.0/10', '110.128.0.0/9', '111.0.0.0/8', '111.16.0.0/12',
        '111.32.0.0/11', '111.64.0.0/10', '111.128.0.0/9', '112.0.0.0/8', '112.16.0.0/12', '112.32.0.0/11', '112.64.0.0/10', '112.128.0.0/9',
        '113.0.0.0/8', '113.16.0.0/12', '113.32.0.0/11', '113.64.0.0/10', '113.128.0.0/9', '114.0.0.0/8', '114.16.0.0/12', '114.32.0.0/11',
        '114.64.0.0/10', '114.128.0.0/9', '115.0.0.0/8', '115.16.0.0/12', '115.32.0.0/11', '115.64.0.0/10', '115.128.0.0/9', '116.0.0.0/8',
        '116.16.0.0/12', '116.32.0.0/11', '116.64.0.0/10', '116.128.0.0/9', '117.0.0.0/8', '117.16.0.0/12', '117.32.0.0/11', '117.64.0.0/10',
        '117.128.0.0/9', '118.0.0.0/8', '118.16.0.0/12', '118.32.0.0/11', '118.64.0.0/10', '118.128.0.0/9', '119.0.0.0/8', '119.16.0.0/12',
        '119.32.0.0/11', '119.64.0.0/10', '119.128.0.0/9', '120.0.0.0/8', '120.16.0.0/12', '120.32.0.0/11', '120.64.0.0/10', '120.128.0.0/9',
        '121.0.0.0/8', '121.16.0.0/12', '121.32.0.0/11', '121.64.0.0/10', '121.128.0.0/9', '122.0.0.0/8', '122.16.0.0/12', '122.32.0.0/11',
        '122.64.0.0/10', '122.128.0.0/9', '123.0.0.0/8', '123.16.0.0/12', '123.32.0.0/11', '123.64.0.0/10', '123.128.0.0/9', '124.0.0.0/8',
        '124.16.0.0/12', '124.32.0.0/11', '124.64.0.0/10', '124.128.0.0/9', '125.0.0.0/8', '125.16.0.0/12', '125.32.0.0/11', '125.64.0.0/10',
        '125.128.0.0/9', '126.0.0.0/8', '126.16.0.0/12', '126.32.0.0/11', '126.64.0.0/10', '126.128.0.0/9', '127.0.0.0/8', '128.0.0.0/8',
        '128.16.0.0/12', '128.32.0.0/11', '128.64.0.0/10', '128.128.0.0/9', '139.0.0.0/8', '139.16.0.0/12', '139.32.0.0/11', '139.64.0.0/10',
        '139.128.0.0/9', '140.0.0.0/8', '140.16.0.0/12', '140.32.0.0/11', '140.64.0.0/10', '140.128.0.0/9', '150.0.0.0/8', '150.16.0.0/12',
        '150.32.0.0/11', '150.64.0.0/10', '150.128.0.0/9', '153.0.0.0/8', '153.16.0.0/12', '153.32.0.0/11', '153.64.0.0/10', '153.128.0.0/9',
        '160.0.0.0/8', '160.16.0.0/12', '160.32.0.0/11', '160.64.0.0/10', '160.128.0.0/9', '163.0.0.0/8', '163.16.0.0/12', '163.32.0.0/11',
        '163.64.0.0/10', '163.128.0.0/9', '171.0.0.0/8', '171.16.0.0/12', '171.32.0.0/11', '171.64.0.0/10', '171.128.0.0/9', '175.0.0.0/8',
        '175.16.0.0/12', '175.32.0.0/11', '175.64.0.0/10', '175.128.0.0/9', '180.0.0.0/8', '180.16.0.0/12', '180.32.0.0/11', '180.64.0.0/10',
        '180.128.0.0/9', '182.0.0.0/8', '182.16.0.0/12', '182.32.0.0/11', '182.64.0.0/10', '182.128.0.0/9', '183.0.0.0/8', '183.16.0.0/12',
        '183.32.0.0/11', '183.64.0.0/10', '183.128.0.0/9', '202.0.0.0/8', '202.16.0.0/12', '202.32.0.0/11', '202.64.0.0/10', '202.128.0.0/9',
        '203.0.0.0/8', '203.16.0.0/12', '203.32.0.0/11', '203.64.0.0/10', '203.128.0.0/9', '210.0.0.0/8', '210.16.0.0/12', '210.32.0.0/11',
        '210.64.0.0/10', '210.128.0.0/9', '211.0.0.0/8', '211.16.0.0/12', '211.32.0.0/11', '211.64.0.0/10', '211.128.0.0/9', '218.0.0.0/8',
        '218.16.0.0/12', '218.32.0.0/11', '218.64.0.0/10', '218.128.0.0/9', '219.0.0.0/8', '219.16.0.0/12', '219.32.0.0/11', '219.64.0.0/10',
        '219.128.0.0/9', '220.0.0.0/8', '220.16.0.0/12', '220.32.0.0/11', '220.64.0.0/10', '220.128.0.0/9', '221.0.0.0/8', '221.16.0.0/12',
        '221.32.0.0/11', '221.64.0.0/10', '221.128.0.0/9', '222.0.0.0/8', '222.16.0.0/12', '222.32.0.0/11', '222.64.0.0/10', '222.128.0.0/9',
        '223.0.0.0/8', '223.16.0.0/12', '223.32.0.0/11', '223.64.0.0/10', '223.128.0.0/9', '240.0.0.0/8', '240.16.0.0/12', '240.32.0.0/11',
        '240.64.0.0/10', '240.128.0.0/9', '255.0.0.0/8', '255.16.0.0/12', '255.32.0.0/11', '255.64.0.0/10', '255.128.0.0/9'
    ];

    /* 訪問者のIPアドレスを取得 */
    $visitor_ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
    $visitor_ip_long = ip2long($visitor_ip);

    if ($visitor_ip_long === false) {
        return; /* 無効なIPアドレスの場合は何もしない */
    }

   /* 各IP範囲をチェック */
    foreach ($blocked_ranges as $range) {
        /* CIDR形式を解析（例: 1.0.1.0/24） */
        list($subnet, $mask) = explode('/', $range);
        $subnet_long = ip2long($subnet);
        $mask = (int)$mask;

        /* サブネットマスクを適用して範囲を計算 */
        $mask_long = ~((1 << (32 - $mask)) - 1);
        $network = $subnet_long & $mask_long;
        $broadcast = $subnet_long | (~$mask_long);

       /* 訪問者のIPが範囲内にあるかチェック */
        if ($visitor_ip_long >= $network && $visitor_ip_long <= $broadcast) {
            /* ブロックされたIPの場合、403エラーを返す */
            header('HTTP/1.1 403 Forbidden');
            echo '<h1>403 Forbidden</h1><p>Access from your IP address is restricted.</p>';
            exit();
        }
    }
}

/* ページロード時にIPチェックを実行 */
add_action('init', 'block_china_ips');