Multiple Taxonomies Filter

Posted in: Newspaper
Post count: 12

Hi,

We’ve created a few custom taxonomies on our site and we want to be able to filter posts in Flex Block 5 using those custom taxonomy term IDs. We know we should use the ‘Multiple Taxonomies Filter’ field for this but it seems we can only use ONE term ID at a time. If we try to apply multiple term IDs, separated by commas, we aren’t getting the correct results. Instead we see the all the posts on the site instead of the filtered list.

Excluding items by commas doesn’t seem to work either. It only seems to work if we use a single item at a time.

Any assistance would be greatly appreciated.

Thanks,

Post count: 12

I am also trying to make use of theme API’s from the documentation. None of those API’s seems to work for me. Can you help me with that as well?

Thanks,

Post count: 35449

Hi,

I just made a test using the multiple taxonomies filter and for me is working correctly -> https://i.imgur.com/BH6yvvJ.png -> https://i.imgur.com/ZKgrZ6E.png the CPT use by me is the one from our guide -> https://forum.tagdiv.com/custom-post-type-support/
This documentation is only for users with developers skills, this is not covered by support team, sorry.

Thank you for you understanding!

Post count: 12

Thanks for the response. To be clear, we were using multiple custom taxonomies when adding those term IDs. We were able to get an appropriate filtered list if we use those terms IDs individually. However, when we try to add them together, it doesn’t seem to work.

Post count: 12

We are a team of developers.

class custom_plugin
{
var $plugin_url = '';
var $plugin_path = '';

function __construct()
{
$this->plugin_url = plugins_url('', __FILE__);
$this->plugin_path = dirname(__FILE__);
add_action('td_global_after', array($this, 'hook_td_global_after'));
add_action('admin_enqueue_scripts', array('td_api_plugin', 'td_plugin_wpadmin_css'));
add_action('wp_enqueue_scripts', array('td_api_plugin', 'td_plugin_frontend_css'));
}

static function td_plugin_wpadmin_css()
{
wp_enqueue_style('td-plugin-framework', plugins_url('', __FILE__) . '/wp-admin/style.css'); // backend css (admin_enqueue_scripts)
}

static function td_plugin_frontend_css()
{
wp_enqueue_style('td-plugin-framework', plugins_url('', __FILE__) . '/css/style.css'); // frontend css (wp_enqueue_scripts)
}

function hook_td_global_after()
{
td_api_single_template::delete('single_template_1');
td_api_single_template::delete('single_template_2');
td_api_single_template::delete('single_template_3');
td_api_single_template::delete('single_template_4');
}
}

new custom_plugin();

We are trying to use td_api_single_template::delete() api to delete bunch of unnecessary templates from the site. But it’s not doing anything.

Can you please help us with that?

Thanks

Post count: 35449

Hi,

I just tried again and for me is working, maybe you have a different implementation for taxonomies and you are not using our guide and plugin from here https://forum.tagdiv.com/custom-post-type-support/ just make a test with this plugin and set the more ids for filter taxonomies.

For the par with deleting single page templates, the theme will use only these that are assigned in theme panel as global and individual, all rest of theme will no affect the theme and website performance. Also if these are cloud templates then you can delete theme from here -> https://i.imgur.com/y5lrUre.png

Thank you for you understanding!

Post count: 12

Hello Calin,

I don’t think you understand our question. Let me elaborate the issue. We created two custom taxonomies name Month & Department. Month has few terms (August, September, October) & Department has few terms (A, B, C). Now we are trying to filer the content related to term A(it’s id is 20) and term September (it’s id is 38) and they were added in the filter like this https://imgur.com/LPNaFYp. The result we are getting out of that filter is inaccurate. The output we are expecting is that it displays the posts from September which belongs to Department A.

We are not using those custom taxonomies with any custom post types, we are using them with Posts.

Hope you understand the issue now and provide a solution for this.

Thank you

Post count: 35449

Hi asce_admin, the results will not be posts from September which belongs to Department A. it will be all posts from September and all posts from Department A.
using the multiple taxonomies filter allow you to set some more taxonomies/categories and all the posts that has assigned one of them to be display.

Thank you for your understanding!

Post count: 8

Hello,
I am having the same problem with the theme.
So how can I use your blocks to display posts that use multiple taxonomies but with the tax_query relation in “AND” and not in “OR”?
thanks

Post count: 35449

Hi demi4444,
If you want to display in blocks some taxonomies, then you can do it using this option -> http://prntscr.com/vgj4i8 unfortunately for the moment those are the only options for taxonomies.
Thank you!

Post count: 8

Hi Calin,
maybe I wasn’t clear. I know I can use multiple taxonomies filter, but in this case the block displays posts that belong to at least one taxonomy-term of the term id list.
Instead I need to display posts that belong to all the terms set in the multiple taxonomy filter.

In other words, the multiple taxonomy filter generates a query that has a tax_query relation in “OR” (not in “AND”), and I really need to modify this behavior.
I investigated and it seems to me that I have to modify the file plugins/td-composer/legacy/common/wp-booster/td_data_source.php (line 137)
$tax_query[‘relation’] = ‘OR’;

But how can I do it in my child theme?
thanks

Post count: 35449

Hi,
Indeed the filter taxonomies is filtering the posts that have at list one category, taxonomy that is set.
Also you are right the file that has the code for this filter is in plugins/td-composer/legacy/common/wp-booster/td_data_source.php but the problem is that this file can not be set in a child theme, it will not work, for the moment can be set only the files from wp-content/plugins/td-composer/legacy/Newspaper and wp-content/plugins/td-standard-pack/Newspaper -> https://forum.tagdiv.com/the-child-theme-support-tutorial/
Thank you for your understating.

Viewing 12 posts - 1 through 12 (of 12 total)
The forum ‘Newspaper’ is closed to new topics and replies.