Tag Info

New answers tagged

0

My solution was to store the term order as metadata for the post. //reset terms if( is_array( $_POST['genres'] ) && count( $_POST['genres'] ) ){ $_POST['genres_order'] = ( $_POST['genres'] = array_map( 'intval', $_POST['genres'] ) ); wp_set_object_terms( $_POST['ID'], $_POST['genres'], 'nv_genre', false ); //will replace any previous genres ...


1

You're already on the right way; just add another loop for the $parent_terms array around your existing loop. Also it might be a good idea to check if the numbers in the array are valid term IDs, so you might end up doing something like this: $parent_terms = array( 1, 2, 3, 10 ); $taxonomy = 'products'; echo '<ul>'; foreach ( $parent_terms as ...


0

I've been successfully using the following code from @StephenHarris from this answer. I have made a small tweak or two to the original code, but the most significant is to name the new count object to count_type from the original COUNT* that was returned by default Just in short again, the function works exactly like you would normally use get_terms. There ...


0

What do you mean by "dynamic" ? Do you want it to work with different posts? If so, that's simple. Before your get_posts query function, get page terms, and pass them to your array. You can get taxonomies with <?php get_the_terms( $yourpostid, 'your_custom_taxonomy'); ?>



Top 50 recent answers are included