New answers tagged

0

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.


2

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, ...


0

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!


3

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


0

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' => '...


0

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