Category tree is flattened inside admin upon saving
I haven’t fully tested this, but it may be helpful: Categories in Hierarchical Order plugin at https://wordpress.org/plugins/categories-in-hierarchical-order/
I haven’t fully tested this, but it may be helpful: Categories in Hierarchical Order plugin at https://wordpress.org/plugins/categories-in-hierarchical-order/
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
For each propery, ask yourself these questions: Is it likely that, on average, more than 1-2 posts will have the same value for this property? If so, do I need to filter posts based on this property, or is it just for display? If you answered both with ‘yes’, then make it a taxonomy, otherwise … Read more
Too much for a comment, so I’ll leave it for an answer: You’re asking a lot of Qs that should actually be different Qs and not dumped into a single one. (Ad 1.) You don’t register “child” or “parent” taxonomies. You add (child-)terms to a hierarchical taxonomy via the WP Back-End UI. You can do … Read more
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
I think you are talking about terms, not categories. You can use wp_list_categories to retrieve and display the terms that a post belongs to. Here is a working example from the codex. Remember the $taxonomy variable can be changed to category or any custom taxonomy <?php $taxonomy = ‘YOUR TAXONOMY NAME’; // get the term … Read more
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
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
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
Add flush_rewrite_rules(); after your register taxonomies. That fixed it for me. Edit Do make sure you do it on install of your plugin if you’re using it on one. It should only be run once on pug-in activation – and not on every page load. Alternatively visit Settings > Permalinks page as this flushes the … Read more