- This works for shortcode [mdf_custom custom_id=777] with attribute 'custom_id' (777 is in the code below) + doesn work with dynamic recount (you can hide count by CSS)
- Example: http://general.wp-filter.com/category/flowers-posts/
- open your current wp theme functions.php file
- drop there next code:12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455//***add_filter('mdf_custom_shortcode_query_args', 'mdf_custom_shortcode_query_args', 10, 2);function mdf_custom_shortcode_query_args($args, $custom_id){$and_tax_relation = array('post_tag');//https://codex.wordpress.org/WordPress_Taxonomyif ($custom_id == '777'){$args['tax_query'] = mdf_modify_tax_query($args['tax_query'], $and_tax_relation);//add_filter('mdf_dyn_tax_recount_args', 'mdf_dyn_tax_recount_args', 10, 1);}return $args;}//*** for dynamic recountadd_filter('mdf_dyn_tax_recount_args', 'mdf_dyn_tax_recount_args', 10, 1);function mdf_dyn_tax_recount_args($tax_query_array){$and_tax_relation = array('post_tag');return mdf_modify_tax_query($tax_query_array, $and_tax_relation);}//logic of AND relations in taxonomiesfunction mdf_modify_tax_query($tax_query_array, $and_tax_relation){if (!empty($tax_query_array)){foreach ($tax_query_array as $key => $value){if (isset($value['taxonomy'])){if (in_array($value['taxonomy'], $and_tax_relation)){$tag_terms = $tax_query_array[$key]['terms'];if (!empty($tag_terms)){$tag_terms_tpl = $tax_query_array[$key];$tag_terms_tpl['terms'] = array();unset($tax_query_array[$key]);foreach ($tag_terms as $term_id){$tag_terms_tpl['terms'] = array($term_id);$tax_query_array[] = $tag_terms_tpl;}}}}}}return $tax_query_array;}
- In the function mdf_dyn_tax_recount_args in array $and_tax_relation write your taxonomy instead 'post_tag' OR using comma add more another taxonomies ...
- Works from version 2.2.1/1.2.1
- Just a video for one the client: https://drive.google.com/file/d/0B4zUhfhZlonlMUNRNTA5RTZJQU0/view