{"id":3373,"date":"2022-11-12T10:29:59","date_gmt":"2022-11-12T01:29:59","guid":{"rendered":"https:\/\/apr20.net\/?p=3373"},"modified":"2022-11-12T10:29:59","modified_gmt":"2022-11-12T01:29:59","slug":"wordpress%e3%81%a7%e7%89%b9%e5%ae%9a%e3%81%ae%e8%a6%aa%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%81%a8%e3%81%9d%e3%81%ae%e5%ad%90%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%81%ab%e6%89%80%e5%b1%9e%e3%81%99","status":"publish","type":"post","link":"https:\/\/apr20.net\/?p=3373","title":{"rendered":"WordPress\u3067\u7279\u5b9a\u306e\u89aa\u30ab\u30c6\u30b4\u30ea\u3068\u305d\u306e\u5b50\u30ab\u30c6\u30b4\u30ea\u306b\u6240\u5c5e\u3059\u308b\u5834\u5408\u306e\u6761\u4ef6\u5206\u5c90\u306e\u65b9\u6cd5"},"content":{"rendered":"<h2>functions.php\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0<\/h2>\n<p>[php]if ( ! function_exists( &#8216;post_is_in_descendant_category&#8217; ) ) {<br \/>\n    function post_is_in_descendant_category( $cats, $_post = null ) {<br \/>\n        foreach ( (array) $cats as $cat ) {<br \/>\n            $descendants = get_term_children( (int) $cat, &#8216;category&#8217; );<br \/>\n            if ( $descendants &amp;&amp; in_category( $descendants, $_post ) )<br \/>\n                return true;<br \/>\n        }<br \/>\n        return false;<br \/>\n    }<br \/>\n}[\/php]<\/p>\n<h2>\u6761\u4ef6\u5206\u5c90\u3092\u3057\u305f\u3044\u5834\u6240\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0<\/h2>\n<p>[php]&lt;?php if ( in_category(\u89aa\u30ab\u30c6\u30b4\u30eaID) || post_is_in_descendant_category(\u89aa\u30ab\u30c6\u30b4\u30eaID) ): ?&gt;<br \/>\n\u3000\u3000\u3000\u3000\/\/ \u300c\u89aa\u30ab\u30c6\u30b4\u30ea\u300d\u3082\u3057\u304f\u306f\u300c\u89aa\u30ab\u30c6\u30b4\u30ea\u300d\u306b\u5c5e\u3059\u308b\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u3082\u306e\u3067\u3042\u3063\u305f\u5834\u5408\u306e\u51fa\u529b\u5185\u5bb9<br \/>\n&lt;?php else: ?&gt;<br \/>\n\u3000\u3000\u3000\u3000\/\/ \u3000\u305d\u308c\u4ee5\u5916\u306e\u51fa\u529b\u5185\u5bb9<br \/>\n&lt;?php endif; ?&gt;[\/php]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>functions.php\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0 [php]if ( ! function&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3373","post","type-post","status-publish","format-standard","hentry","category-wordpress-web-category"],"_links":{"self":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/3373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3373"}],"version-history":[{"count":0,"href":"https:\/\/apr20.net\/index.php?rest_route=\/wp\/v2\/posts\/3373\/revisions"}],"wp:attachment":[{"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apr20.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}