Why does my taxonomy code display the first alphabetical term?

With wp_get_object_terms() you’re able to manipulate the sorting. Make sure you tweak the sorting to what you want. Try something more or less like this (Updated: 5/17/2012 — 8:15AM): $taxonomyName=”producttype”; $terms = wp_get_object_terms($wp_query->post->ID, $taxonomyName, array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘fields’ => ‘all’)); if(!empty($terms)){ if(!is_wp_error($terms)){ for($i = 0; $i < count($terms); $i++){ if($terms[$i]->parent != 0){ … Read more

Passing values by form to create a query

It all depends on how you’re trying to do it. When it comes to filtering results, i usually setup the form to use $_GET and filter the results when the page loads again: if (isset($_GET[‘term’])) { $term = $_GET[‘term’]; } else { $term = ‘defaultTerm’; } if (isset($_GET[‘childterm’])) { $childterm = $_GET[‘childterm’]; } else { … Read more

Show min and max taxonomy values

Not sure but try this: function get_years ($taxonomies, $args){ $output = array(); $hlterms = get_terms($taxonomies, $args); foreach($hlterms as $term){ $term_taxonomy = $term->year; array_push($output, $term->name); } return $output; } $taxonomies = array (‘year’); $args = array (‘hide_empty’=>true); $year = get_years($taxonomies, $args); echo min($year);

Echo used hierarchical taxonomies parent name

Try this: <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); $parent = get_term($term->parent, get_query_var(‘taxonomy’) ); echo $parent->name; ?> You have to get the current term slug and then use get_term by the slug and then echo the name.

multiple taxonomies in wp_list_categories’ $args

Have you noticed in the list all of valid Parameters for wp_list_categories() function that taxonomy doesn’t accept input as array, thats why you are not supposed to pass an array to it. If you still want to be able to show terms of two different taxonomies, use get_terms() WordPress function instead. The only bad is … Read more

Child Terms not Displaying on the Taxonomy Term Admin Screen

I’ve encountered this kind of problem when i was building some front end post / term creation form. The number oh the ‘Right Now’ dashboard shows the right number of term, but the new term doesn’t shows up in the taxonomy admin screen. The solution: delete_option(‘taxonomy-name_children’); where ‘taxonomy-name’ is the name of the taxonomy. Hope … Read more

Apply custom taxonomy archive template to children

As you can see in this image, template hierarchy limits to taxonomy-$taxonomy-$term.php. I don’t know why a subterm falls back to taxonomy-$taxonomy.php, but I guess it searches for a taxonomy-$taxonomy-$term.php in wich $term would be workshops, science labs and so on. And since those don’t exist (I suppose), it falls back on taxonomy-$taxonomy.php. You could … Read more