Add Column to Term Database

I have a feeling that modifying that table is not a good idea. I hadn’t done something like this, but if I needed to deal with considerable amount of meta information for terms I’d try to leverage Metadata API, which for terms would involve setting up separate storage table.

get_the_term_list() wanting to loop through the returned values

I would use wp_get_object_terms which will return an array of object terms that you can manipulate. You also have a little more control with sorting the terms. <?php $terms = wp_get_object_terms($post->ID, ‘work’, array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’)); if(is_array($terms)) : ?> <ul> <?php if(isset($terms[0])) : ?><li><a href=”https://wordpress.stackexchange.com/questions/22940/<?php echo get_term_link($terms[0]); ?>”>Find out more about <?php echo … Read more

Order taxonomy terms by the frequency of use in the last 30 days

First thing’s first — You’ll have to add that table. The way you do that if you were writing this in a plugin is as follows: function customtaxorder_init() { global $wpdb; $init_query = $wpdb->query(“SHOW COLUMNS FROM $wpdb->terms LIKE ‘term_order'”); if ($init_query == 0) { $wpdb->query(“ALTER TABLE $wpdb->terms ADD `term_order` INT( 4 ) NULL DEFAULT ‘0’”); … Read more

Get object terms with no children?

I have written this function some time ago, it may be a bit sloppy but it does it’s job: function get_low_level_term( $taxonomy ) { $term = null; if( is_single() ) { global $post; $terms = get_the_terms( $post->ID, $taxonomy ); if( count( $terms ) == 1 ) { foreach( $terms as $t ) { $term = … 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