<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>

		<title>Using wp_query to display only specific taxonomy terms from a custom post type &#8211; Themeco Community</title>
		<atom:link href="https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/feed/" rel="self" type="application/rss+xml" />
		<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/feed/</link>
		<description></description>
		<lastBuildDate>Sat, 11 Oct 2025 11:55:49 +0000</lastBuildDate>
		<generator>https://bbpress.org/?v=2.6.14</generator>
		<language>en-US</language>

		
														
					
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-314136</guid>
					<title><![CDATA[Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-314136</link>
					<pubDate>Fri, 26 Jun 2015 23:29:14 +0000</pubDate>
					<dc:creator>Pinnacle</dc:creator>

					<description>
						<![CDATA[
						<p>Hi hi! </p>
<p>I&#8217;m trying to use wp_query on a custom post type archive page to only loop in two terms from said custom post type&#8217;s taxonomy, and can&#8217;t seem to get it right (unless there is something else going on that I&#8217;m missing). </p>
<p>I have created a custom archive-{cpt}.php, wp-archive-{cpt}.php, and _archive-{cpt}.php and connected them, confirming that they do actually affect the archive&#8217;s display, and then attempted to wp_query the loop to call only the taxonomy terms I want using tax_query. I am new to wp_query but thought I had it right &#8212; unfortunately, I keep getting all posts instead of the posts from the two taxonomy terms. I tried several different ways, but received either errors or a blank page with pagination numbers at the bottom. </p>
<p>Here is the base of what I tried on the _archive-{cpt}.php file: </p>
<pre><code>&lt;div id=&quot;x-iso-container&quot; class=&quot;x-iso-container x-iso-container-posts cols-&lt;?php echo $cols; ?&gt;&quot;&gt;

    &lt;?php if ( have_posts() ) : ?&gt;
      &lt;?php while ( have_posts() ) : the_post(); ?&gt;
        &lt;?php if ( $stack != &#039;ethos&#039; ) : ?&gt;
          &lt;?php x_get_view( $stack, &#039;content&#039;, get_post_format() ); ?&gt;
        &lt;?php else : ?&gt;
          &lt;?php x_ethos_entry_cover( &#039;main-content&#039; ); ?&gt;
        &lt;?php endif; ?&gt;
      &lt;?php endwhile; ?&gt;
    &lt;?php else : ?&gt;
      &lt;?php x_get_view( &#039;global&#039;, &#039;_content-none&#039; ); ?&gt;
    &lt;?php endif; ?&gt;

&lt;?php 

    wp_reset_postdata();

    $args = array(
    
      &#039;post_type&#039; =&gt; &#039;customposttype&#039;,
      &#039;tax_query&#039;  =&gt; array(
        array(
          &#039;taxonomy&#039; =&gt; &#039;cpt_category&#039;,
          &#039;field&#039;    =&gt; &#039;slug&#039;,
          &#039;terms&#039;    =&gt; &#039;category-term-1&#039;, &#039;category-term-2&#039;,
        ),
      ),
      &#039;posts_per_page&#039; =&gt; 10
    
    );

    $the_query = new WP_Query( $args );

?&gt;

    &lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;
      &lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;
        &lt;?php if ( $stack != &#039;ethos&#039; ) : ?&gt;
          &lt;?php x_get_view( $stack, &#039;content&#039;, get_post_format() ); ?&gt;
        &lt;?php else : ?&gt;
          &lt;?php x_ethos_entry_cover( &#039;main-content&#039; ); ?&gt;
        &lt;?php endif; ?&gt;
      &lt;?php endwhile; ?&gt;
    &lt;?php else : ?&gt;
      &lt;?php x_get_view( &#039;global&#039;, &#039;_content-none&#039; ); ?&gt;
    &lt;?php endif; ?&gt;

  &lt;/div&gt;

&lt;?php pagenavi(); ?&gt;</code></pre>
<p>Note that I tried paring down/removing the if statements, calling the query in various areas, etc. Hopefully, you can point me in the right direction. </p>
<p>Thanks! </p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-314351</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-314351</link>
					<pubDate>Sat, 27 Jun 2015 05:37:17 +0000</pubDate>
					<dc:creator>Rue Nel</dc:creator>

					<description>
						<![CDATA[
						<p>Hello There,</p>
<p>Thanks for writing in!</p>
<p>To assist you with this issue, we&#8217;ll first need you to provide us with your URL with ftp and login credentials so we can take a closer look. We want to see how you organize your template files.</p>
<p>To do this, please post<br />
– Link to your site <br />
– WordPress Admin username / password<br />
&#8211; FTP user / password</p>
<p><strong>Don’t forget to select Set as private reply</strong> so that it is only visible to our staff.</p>
<p>This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.</p>
<p>Thank you.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316143</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316143</link>
					<pubDate>Mon, 29 Jun 2015 16:32:48 +0000</pubDate>
					<dc:creator>Pinnacle</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316175</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316175</link>
					<pubDate>Mon, 29 Jun 2015 17:16:09 +0000</pubDate>
					<dc:creator>Thai</dc:creator>

					<description>
						<![CDATA[
						<p>Hey There,</p>
<p>Please update your $args variable a bit:</p>
<pre><code>    $args = array(
    
      &#039;post_type&#039; =&gt; &#039;customposttype&#039;,
      &#039;tax_query&#039;  =&gt; array(
        array(
          &#039;taxonomy&#039; =&gt; &#039;cpt_category&#039;,
          &#039;field&#039;    =&gt; &#039;slug&#039;,
          &#039;terms&#039;    =&gt; array(&#039;category-term-1&#039;, &#039;category-term-2&#039;)
        ),
      ),
      &#039;posts_per_page&#039; =&gt; 10
    
    );</code></pre>
<p>Hope it helps.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316265</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316265</link>
					<pubDate>Mon, 29 Jun 2015 18:47:52 +0000</pubDate>
					<dc:creator>Pinnacle</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316896</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316896</link>
					<pubDate>Tue, 30 Jun 2015 11:47:22 +0000</pubDate>
					<dc:creator>Zeshan</dc:creator>

					<description>
						<![CDATA[
						<p>Hi there,</p>
<p>Thanks for writing in!</p>
<p>This is more likely a custom development, that is outside the scope of support we can offer. However, I could point you in the right direction with the understanding that it would ultimately be your responsibility to take it from here. </p>
<p>I&#8217;m unable to login to your FTP account using the given credentials. Please confirm again. For now, can you reverse the change you made so I can see the posts/listings and check the causing conflict?</p>
<p>Thanks!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316975</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-316975</link>
					<pubDate>Tue, 30 Jun 2015 13:21:14 +0000</pubDate>
					<dc:creator>Pinnacle</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-317214</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-317214</link>
					<pubDate>Tue, 30 Jun 2015 16:39:05 +0000</pubDate>
					<dc:creator>Zeshan</dc:creator>

					<description>
						<![CDATA[
						<p>Hi there,</p>
<p>Thanks for the correct logins!</p>
<p>I just went ahead and updated your code with following, this should now work just fine:</p>
<pre><code>&lt;?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( &#039;x_blog_style&#039;, &#039;standard&#039; );
  $cols      = x_get_option( &#039;x_blog_masonry_columns&#039;, &#039;2&#039; );
  $condition = is_home() &amp;&amp; $style == &#039;masonry&#039;;
elseif ( is_archive() ) :
  $style     = x_get_option( &#039;x_archive_style&#039;, &#039;standard&#039; );
  $cols      = x_get_option( &#039;x_archive_masonry_columns&#039;, &#039;2&#039; );
  $condition = is_archive() &amp;&amp; $style == &#039;masonry&#039;;
elseif ( is_search() ) :
  $condition = false;
endif;

// =============================================================================
// INSTRUCTIONS ADDED BY X STAFF
// =============================================================================

// 
// Added this line so the condition will always be true 
// this will enable the masonry style
// set it to false if you don&#039;t want Masonry layout
// 

$condition = true;

// 
// Change &quot;2&quot; to your desired value (3, 4) to change the column 
// count on this custom archive page
// 

$cols = 2;

// 
// Adding the WP_Query $args
// 

$args = array(

  &#039;post_type&#039; =&gt; &#039;bullhornjoblisting&#039;,
  &#039;tax_query&#039;  =&gt; array(
    array(
      &#039;taxonomy&#039; =&gt; &#039;bullhorn_category&#039;,
      &#039;field&#039;    =&gt; &#039;slug&#039;,
      &#039;terms&#039;    =&gt; array(&#039;accounting-finance-executive-and-professional&#039;, &#039;accounting-finance-term-and-permanent&#039;)
    ),
  ),
  &#039;posts_per_page&#039; =&gt; 10

);

?&gt;

&lt;div class=&quot;x-container max width&quot;&gt;

&lt;?php if ( $condition ) : ?&gt;

  &lt;?php x_get_view( &#039;global&#039;, &#039;_script&#039;, &#039;isotope-index&#039; ); ?&gt;

  &lt;div id=&quot;x-iso-container&quot; class=&quot;x-iso-container x-iso-container-posts cols-&lt;?php echo $cols; ?&gt;&quot;&gt;

    &lt;?php $the_query = new WP_Query( $args ); ?&gt;
    &lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;
      &lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;
        &lt;?php if ( $stack != &#039;ethos&#039; ) : ?&gt;
          &lt;?php x_get_view( $stack, &#039;content&#039;, get_post_format() ); ?&gt;
        &lt;?php else : ?&gt;
          &lt;?php x_ethos_entry_cover( &#039;main-content&#039; ); ?&gt;
        &lt;?php endif; ?&gt;
      &lt;?php endwhile; ?&gt;
    &lt;?php else : ?&gt;
      &lt;?php x_get_view( &#039;global&#039;, &#039;_content-none&#039; ); ?&gt;
    &lt;?php endif; wp_reset_postdata(); ?&gt;

  &lt;/div&gt;

&lt;?php else : ?&gt;

  &lt;?php $the_query = new WP_Query( $args ); ?&gt;
  &lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;
    &lt;?php while ( $the_query-&gt;have_posts() ) : the_post(); ?&gt;
      &lt;?php x_get_view( $stack, &#039;content&#039;, get_post_format() ); ?&gt;
    &lt;?php endwhile; ?&gt;
  &lt;?php else : ?&gt;
    &lt;?php x_get_view( &#039;global&#039;, &#039;_content-none&#039; ); ?&gt;
  &lt;?php endif; ?&gt;

&lt;?php endif; ?&gt;

&lt;?php pagenavi(); ?&gt;
&lt;/div&gt;
</code></pre>
<p>You can compare both using a tool difference tool such as <a href="https://www.diffchecker.com/" rel="nofollow">https://www.diffchecker.com/</a>. I&#8217;ve also added some instructions at the top of the page, you may also want to review them.</p>
<p>Thanks!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-317279</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-317279</link>
					<pubDate>Tue, 30 Jun 2015 17:39:33 +0000</pubDate>
					<dc:creator>Pinnacle</dc:creator>

					<description>
						<![CDATA[
						<p>You guys are -AWESOME-! </p>
<p>It works swimmingly &#8212; with one small hiccup: the pagenavi code at the bottom gave me 8 pages of the same thing over and over again. I solved that by simply deleting it and changing the posts per page to -1, but wouldn&#8217;t mind knowing why it happened inn case I get asked to add pagination back in.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-317750</guid>
					<title><![CDATA[Reply To: Using wp_query to display only specific taxonomy terms from a custom post type]]></title>
					<link>https://theme.co/archive/forums/topic/using-wp_query-to-display-only-specific-taxonomy-terms-from-a-custom-post-type/#post-317750</link>
					<pubDate>Wed, 01 Jul 2015 03:36:22 +0000</pubDate>
					<dc:creator>Rad</dc:creator>

					<description>
						<![CDATA[
						<p>Hi there,</p>
<p>-1 means select all, that could be the  reason why you&#8217;re getting same pages since you&#8217;re selecting same results. But it&#8217;s a little weird too, and glad it&#8217;s solved now.</p>
<p>Thanks!</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

