New answers tagged


You can easily just get the taxonomies you need with wp_get_object_terms, and than do something like $class =''; foreach ($genres as $genre) { $class .= $genre->slug; } Do this for each of your taxonomies,than just echo $class.


The dynamic filter "term_{$field}" is probably what you're looking for, where the field is "name." One approach is to have an array of names and their pseudonyms, then do a check-and-return on them so they'll display the replacement. add_filter( 'term_name', function( $value ) { $terms = [ 'old' => 'new', ]; // basic example check, ...


I was working on someone else WP installation so I can get the info of WP Database to show Products information in a side-page. I've noticed that they have a plugin installed (Taxonomy order) that always return the terms posts in the same orden. Sorry for the confusion!


Maybe try wp_insert_term once the plugin has been enabled: I.e. wp_insert_term( 'Male', // the term 'dog_sex', // the taxonomy array( 'slug' => 'male', ) );


I've finally solved this problem. I'm copying the code because it may help someone :) I've found the solution by populating an arrray and checking if a brand is or is not there, so I only get each brand one time. <?php //Query to match department $args = array( 'tax_query' => array( array( 'taxonomy' => '...


This is my best approach: Store the values in an array during the while loop, and then using array_count_values php function, you obtain the desired output. It is untested, but I think it should work: if ( $query->have_posts() ) { //in this variable, declared as an array, we will store the values $products_array = array(); while ( $query-&...

Top 50 recent answers are included