{"id":2710622,"date":"2012-04-25T20:11:42","date_gmt":"2012-04-25T20:11:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/multiple-if-is_category\/"},"modified":"2016-08-20T11:55:43","modified_gmt":"2016-08-20T11:55:43","slug":"multiple-if-is_category","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/multiple-if-is_category\/","title":{"rendered":"Multiple if is_category"},"content":{"rendered":"<p>Ive an existing code but is too long as ive many categories (&gt;30). If i were to use the below code, it seems too much. Is there a better way to do it? <\/p>\n<pre><code>&lt;?php if ( is_category(&#039;1&#039;) || is_category(&#039;2&#039;) || is_category(&#039;3&#039;) ) {\n    echo &#039;hi&#039;;\n}\n?&gt;<\/code><\/pre>\n<p>Basically i want all child categories within the main category, not the posts under the child categories. Thanks for your time.<\/p>\n","protected":false},"template":"","class_list":["post-2710622","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2710622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2710622\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=2710622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}