{"id":9697877,"date":"2017-11-18T23:55:08","date_gmt":"2017-11-18T23:55:08","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/help-with-php-array\/"},"modified":"2017-11-18T23:55:08","modified_gmt":"2017-11-18T23:55:08","slug":"help-with-php-array","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/help-with-php-array\/","title":{"rendered":"Help with PHP array"},"content":{"rendered":"<p>Can someone please help me edit an array so that instead of displaying posts from one category ID (8), the array displays posts from either category ID 8 <strong>OR<\/strong> category ID 649?<\/p>\n<p>An example is on this page, under &#8220;Agents Listings&#8221;:<br \/>\nhttp:\/\/bulldogrealtors.com\/agents\/jeff-curtis<\/p>\n<p>The page is currently displaying any of the Agent&#8217;s Listings (posts) with category ID = 8.  Here is the code that works for the single category:<\/p>\n<p>&lt;div class=&#8221;row-agent&#8221;&gt;<br \/>\n      &lt;?php $agent_name = get_the_title(); ?&gt;<br \/>\n      &lt;div class=&#8221;none&#8221;&gt;&lt;?php<br \/>\n        query_posts(array(<br \/>\n            &#8216;cat&#8217; =&gt; 8,<br \/>\n            &#8216;showposts&#8217;    =&gt; 4,<br \/>\n            &#8216;meta_query&#8217; =&gt; array(<br \/>\n              array(<br \/>\n                 &#8216;key&#8217; =&gt; &#8216;agent&#8217;,<br \/>\n                 &#8216;value&#8217; =&gt; $agent_name,<br \/>\n                 &#8216;compare&#8217; =&gt; &#8216;LIKE&#8217;,<br \/>\n              )<br \/>\n            ),<br \/>\n        ));<br \/>\n        ?&gt;<br \/>\n      &lt;\/div&gt;<\/p>\n<p>All I need to do is also show any of the Agent&#8217;s posts from category ID = 649, so that if the Agent has two posts with category ID 8 and two posts with category ID 649, the page would show all fours posts.  <\/p>\n<p>It doesn&#8217;t matter if it first shows posts from category ID 8 and only then from category ID 649, I just need posts with category ID 649 to show if there are less than 4 posts with category 8.<\/p>\n<p>I hope this makes sense and I really appreciate the help.<\/p>\n<p>Best,<br \/>\nP<\/p>\n","protected":false},"template":"","class_list":["post-9697877","topic","type-topic","status-publish","hentry","topic-tag-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9697877","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\/9697877\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=9697877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}