<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Reacties voor Weichie	</title>
	<atom:link href="https://old.weichie.com/nl/comments/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Web development for forward thinking brands</description>
	<lastBuildDate>Wed, 13 Apr 2022 14:24:57 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.13</generator>
	<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Bob Weichler		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7873</link>

		<dc:creator><![CDATA[Bob Weichler]]></dc:creator>
		<pubDate>Thu, 01 Oct 2020 05:02:50 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7873</guid>

					<description><![CDATA[In antwoord op &lt;a href=&quot;https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7868&quot;&gt;Nino&lt;/a&gt;.

Hi Nino, I removed your code examples from your reply as it became a mess in the backoffice. Please use pastebin or github gists to show your code. For combining multiple filters at once, I will add an additional section in my blog post. You need to build up your $args before you make the new WP_Query. Here&#039;s a small example of how you can build your args query. I will try to expand my post over the weekend but hopefully this snippet can get you started.

&lt;pre&gt;&lt;code&gt;// Set your default query params
$args = [
   &#039;post_type&#039;      =&gt; &#039;product&#039;,
   &#039;posts_per_page&#039; =&gt; -1,
   &#039;post_status&#039;    =&gt; &#039;publish&#039;,
   &#039;orderby&#039;        =&gt; &#039;date&#039;,
   &#039;order&#039;          =&gt; &#039;desc&#039;,
];

// Add each extra taxonomy query like this:
$args[&#039;tax_query&#039;][] = [
   &#039;taxonomy&#039;      =&gt; &#039;product_cat&#039;,
   &#039;field&#039;	   =&gt; &#039;term_id&#039;,
   &#039;terms&#039;         =&gt; $catIds,
   &#039;operator&#039;      =&gt; &#039;IN&#039;
];

// Make a new WP_Query with the $args array
$ajaxproducts = new WP_Query($args);&lt;/code&gt;&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In antwoord op <a href="https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7868">Nino</a>.</p>
<p>Hi Nino, I removed your code examples from your reply as it became a mess in the backoffice. Please use pastebin or github gists to show your code. For combining multiple filters at once, I will add an additional section in my blog post. You need to build up your $args before you make the new WP_Query. Here&#8217;s a small example of how you can build your args query. I will try to expand my post over the weekend but hopefully this snippet can get you started.</p>
<pre><code>// Set your default query params
$args = [
   'post_type'      => 'product',
   'posts_per_page' => -1,
   'post_status'    => 'publish',
   'orderby'        => 'date',
   'order'          => 'desc',
];

// Add each extra taxonomy query like this:
$args['tax_query'][] = [
   'taxonomy'      => 'product_cat',
   'field'	   => 'term_id',
   'terms'         => $catIds,
   'operator'      => 'IN'
];

// Make a new WP_Query with the $args array
$ajaxproducts = new WP_Query($args);</code></pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Nino		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7868</link>

		<dc:creator><![CDATA[Nino]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 18:47:20 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7868</guid>

					<description><![CDATA[In antwoord op &lt;a href=&quot;https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7866&quot;&gt;Bob Weichler&lt;/a&gt;.

Thank you very much Bob for the fast reply. I will try to explain myself. I have figured it out I able to sort based on taxonomy. I would like to use 2 SELECT for 2 different taxonomies one for themes and one for subjects which are 2 taxonomies. How can I use a SELECT for multiple tax filtering? When is select one dropdown option it will filter all over again, is there a way I can simply do this? So basically giving users the option to filter on 2 select fields instead of one.]]></description>
			<content:encoded><![CDATA[<p>In antwoord op <a href="https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7866">Bob Weichler</a>.</p>
<p>Thank you very much Bob for the fast reply. I will try to explain myself. I have figured it out I able to sort based on taxonomy. I would like to use 2 SELECT for 2 different taxonomies one for themes and one for subjects which are 2 taxonomies. How can I use a SELECT for multiple tax filtering? When is select one dropdown option it will filter all over again, is there a way I can simply do this? So basically giving users the option to filter on 2 select fields instead of one.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Bob Weichler		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7866</link>

		<dc:creator><![CDATA[Bob Weichler]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 15:49:12 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7866</guid>

					<description><![CDATA[In antwoord op &lt;a href=&quot;https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7863&quot;&gt;Nino&lt;/a&gt;.

Hi Nino, I removed a bit from your code as it became too long. I left the query part in your answer. If you&#039;re not using categories, you need to remove the &#039;category_name&#039; from the arguments. The Tax Query in my previous example was filled with dummy content. You need to change the custom-taxonomy and your-term-slug with your actual taxonomy.]]></description>
			<content:encoded><![CDATA[<p>In antwoord op <a href="https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7863">Nino</a>.</p>
<p>Hi Nino, I removed a bit from your code as it became too long. I left the query part in your answer. If you&#8217;re not using categories, you need to remove the &#8216;category_name&#8217; from the arguments. The Tax Query in my previous example was filled with dummy content. You need to change the custom-taxonomy and your-term-slug with your actual taxonomy.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Nino		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7864</link>

		<dc:creator><![CDATA[Nino]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 15:41:36 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7864</guid>

					<description><![CDATA[In antwoord op &lt;a href=&quot;https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7862&quot;&gt;Bob Weichler&lt;/a&gt;.

Hi Bob,

How can I add code here? For some reason, It is just not working for me.]]></description>
			<content:encoded><![CDATA[<p>In antwoord op <a href="https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7862">Bob Weichler</a>.</p>
<p>Hi Bob,</p>
<p>How can I add code here? For some reason, It is just not working for me.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Nino		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7863</link>

		<dc:creator><![CDATA[Nino]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 15:38:36 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7863</guid>

					<description><![CDATA[In antwoord op &lt;a href=&quot;https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7862&quot;&gt;Bob Weichler&lt;/a&gt;.

Hey Bob,

I have created a custom taxonomy themes with multiple values in the back-end. I am able to return them when looping through them. But filtering is not working. I am not using categories but would like to filter by taxonomy. I have tried to apply your code but without luck. 

&lt;pre&gt;&lt;code&gt;
function filter_updates() {
    $postType = $_POST[&#039;type&#039;];
    $catSlug = $_POST[&#039;category&#039;];

  $ajaxposts = new WP_Query([
    &#039;post_type&#039; =&#062; $postType,
    &#039;posts_per_page&#039; =&#062; -1,
    &#039;category_name&#039; =&#062; $catSlug,
    &#039;orderby&#039; =&#062; &#039;menu_order&#039;,
    &#039;order&#039; =&#062; &#039;desc&#039;,
    &#039;tax_query&#039; =&#062; [
        [
           &#039;taxonomy&#039; =&#062; &#039;custom-taxonomy&#039;,
           &#039;field&#039;    =&#062; &#039;slug&#039;,
           &#039;terms&#039;    =&#062; array(&#039;your-term-slug&#039;),
        ],
     ]
  ]);
}
&lt;/code&gt;&lt;/pre&gt;

Could you see what is causing this issue? When trying to filter it returns only one post.]]></description>
			<content:encoded><![CDATA[<p>In antwoord op <a href="https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7862">Bob Weichler</a>.</p>
<p>Hey Bob,</p>
<p>I have created a custom taxonomy themes with multiple values in the back-end. I am able to return them when looping through them. But filtering is not working. I am not using categories but would like to filter by taxonomy. I have tried to apply your code but without luck. </p>
<pre><code>
function filter_updates() {
    $postType = $_POST['type'];
    $catSlug = $_POST['category'];

  $ajaxposts = new WP_Query([
    'post_type' =&gt; $postType,
    'posts_per_page' =&gt; -1,
    'category_name' =&gt; $catSlug,
    'orderby' =&gt; 'menu_order',
    'order' =&gt; 'desc',
    'tax_query' =&gt; [
        [
           'taxonomy' =&gt; 'custom-taxonomy',
           'field'    =&gt; 'slug',
           'terms'    =&gt; array('your-term-slug'),
        ],
     ]
  ]);
}
</code></pre>
<p>Could you see what is causing this issue? When trying to filter it returns only one post.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Bob Weichler		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7862</link>

		<dc:creator><![CDATA[Bob Weichler]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 15:15:17 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7862</guid>

					<description><![CDATA[In antwoord op &lt;a href=&quot;https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7861&quot;&gt;Nino&lt;/a&gt;.

Hi Nino,
For custom taxonomies you need to change your query to something like this: 

&lt;pre&gt;&lt;code&gt;$projects = new WP_Query([
   &#039;post_type&#039; =&gt; &#039;projecten&#039;,
   &#039;posts_per_page&#039; =&gt; -1,
   &#039;tax_query&#039; =&gt; [
      [
         &#039;taxonomy&#039; =&gt; &#039;custom-taxonomy&#039;,
         &#039;field&#039;    =&gt; &#039;slug&#039;,
         &#039;terms&#039;    =&gt; array(&#039;your-term-slug&#039;),
         &#039;operator&#039; =&gt; &#039;IN&#039;
      ],
   ]
]);&lt;/pre&gt;&lt;/code&gt;

It&#039;s untested so let me know if it works correctly for taxonomies. I&#039;ll add it to the article if it does.]]></description>
			<content:encoded><![CDATA[<p>In antwoord op <a href="https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7861">Nino</a>.</p>
<p>Hi Nino,<br />
For custom taxonomies you need to change your query to something like this: </p>
<pre><code>$projects = new WP_Query([
   'post_type' => 'projecten',
   'posts_per_page' => -1,
   'tax_query' => [
      [
         'taxonomy' => 'custom-taxonomy',
         'field'    => 'slug',
         'terms'    => array('your-term-slug'),
         'operator' => 'IN'
      ],
   ]
]);</code></pre>
<p>It's untested so let me know if it works correctly for taxonomies. I'll add it to the article if it does.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		Reactie op WordPress Filter Posts with Ajax, without page-reload or plugins door Nino		</title>
		<link>https://old.weichie.com/nl/blog/wordpress-filter-posts-with-ajax/#comment-7861</link>

		<dc:creator><![CDATA[Nino]]></dc:creator>
		<pubDate>Wed, 30 Sep 2020 15:02:27 +0000</pubDate>
		<guid isPermaLink="false">https://old.weichie.com/?p=3338#comment-7861</guid>

					<description><![CDATA[Hi man!

What do I have to change to filter on a taxonomy instead of a category? What do I have to change?

Thanks!]]></description>
			<content:encoded><![CDATA[<p>Hi man!</p>
<p>What do I have to change to filter on a taxonomy instead of a category? What do I have to change?</p>
<p>Thanks!</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
