Taxonomy/category hierarchy lost when editing posts [closed]
Taxonomy/category hierarchy lost when editing posts [closed]
Taxonomy/category hierarchy lost when editing posts [closed]
You could indeed, achieve everything with categories, but is it a good idea? If all main categories are 2010, 2011, 2012 and each of them has subcategories named Room1, Room2, etc., you would indeed have an easy way to make your searches by year or by room. The search by year would be as simple … Read more
Don’t know how did you set the post type and the taxonomy, but by default I think you’re supposed to see all quotes from an author through myblogname.com/the-author-name. If you want to place static words such auteur or citation in the link, then this is related to how you set the options for creating the … Read more
Ok, so I will get negative points for this, but it should solve your problem, please dont be mad at me. Before anyone downvote me for this, I must say that I have nothing to do with the developers of this plugin: For custom taxonomies and custom post types I often use a plugin named … Read more
Copy the following snippet and paste it into the code of your theme, preferably in the functions.php file: /* Exclude a Category from Search Results */ add_filter( ‘pre_get_posts’ , ‘search_exc_cats’ ); function search_exc_cats( $query ) { if( $query->is_admin ) return $query; if( $query->is_search ) { $query->set( ‘category__not_in’ , array( 30 ) ); // Cat ID … Read more
Ad slowing down) Lame answer: depends on your server and stuff. Ad possible bug) wp_count_terms(); is a level “above” get_terms(); and therefore has values like ‘hide_empty’ and ‘fields’ already set. I’d say: diff your $args against those predefinied by wp_count_term();. The later function does nothing than calling the get_terms() at it’s end.
You’ll need to loop through your posts, use get_comments_number() to get the number of comments for each post, and then accumulate the total number of comments in a separate variable. e.g.: <?php $features_comment_count = 0; if ( have_posts() ) : while ( have_posts() ) : the_post(); $features_comment_count += get_comments_number(); endwhile; endif; ?> (I’ll assume that … Read more
There’s a plugin written specifically to fix this ‘feature’ of WordPress, it’s called Category Checklist Tree. Despite the name, it works on custom taxonomies too.
Here’s more of a complete guide based on the $wp_query object: The Taxonomy First you might want to know in which taxonomy you are, what its name is and retrieve all its available data from the object. // Taxonomy name $taxonomy = get_query_var( ‘taxonomy’ ); // Taxonomy object get_taxonomy( $taxonomy ); // Taxonomy name get_taxonomy( … Read more
Okay, the following code should do the trick for you: function get_clients_correct_template($single_template) { global $post; if ( ‘clients’ == $post->post_type ) { $_template = false; // Get all the terms for this post $categories = wp_get_post_terms( $post->ID, ‘clients_categories’ ); if ( $categories && ! is_wp_error( $categories ) ) { global $wp; // I guessed that … Read more