Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area

Oh, I love it when you give me an easy one. Starts to make up for all those harder ones… (well, partly. 😉 So what you want is to replace this: (source: mikeschinkel.com) With this: (source: mikeschinkel.com) How? Use the ‘wp_tag_cloud’ hook which you can put into your theme’s functions.php file or in a .php … Read more

wp query with dynamic taxonomies and terms?

Here is one idea for a dynamic multiple taxonomy query: // construct the tax-query: $tax_query = array( ‘relation’ => ‘AND’ ); // check if movie_genre taxonomy is to be included if( $bMovieGenre ){ $tax_query[] = array( ‘taxonomy’ => ‘movie_genre’, ‘field’ => ‘slug’, ‘terms’ => array( ‘action’, ‘comedy’ ) ); } // check if actor taxonomy … Read more

How to count the number of terms in a taxonomy

As @shanebp suggests, you could use wp_count_terms() like this: $numTerms = wp_count_terms( ‘service-category’, array( ‘hide_empty’=> false, ‘parent’ => 0 ) ); The above will list All top parent terms, empty or not. This function uses get_terms() functions arguments which can be found in the link or the arguments below: $args = array( ‘orderby’ => ‘name’, … Read more

CPT Search Form with Taxonomy filter & Or

I think you can do it in two following steps: In HTML code just add a dropdown with the values you need. <select name=”yourselect”><option value=”1″>Value 1</option> … </select> In your pre_get_posts filter add tax_query parameter like this if( !empty( $_GET[‘yourselect’] ) ) { $query->set(‘tax_query’, array( array( ‘taxonomy’ => ‘YOUR_TAXONOMY_NAME’, ‘field’ => ‘id’, // or slug … Read more

If a function requires add_action(‘init’) how can I run it only once on plugin activation?

I don’t think there is a need to add the items to the init hook from the activation function. I think you can call them directly: private static function single_activate() { self::add_partner_terms(); //$this->add_partner_terms(); self::add_geo_terms(); //$this->add_geo_terms(); } I’m not really sure if it should be self:: or $this-> because I’m a little bit fuzzy about OOP, … Read more