Category taxonomy template not working for custom post

The hierarchy for a custom taxonomy is listed below: taxonomy-{taxonomy}-{term}.php: For example, if the taxonomy is named “sometax,” and the taxonomy’s term is “someterm,” WordPress would look for a file named taxonomy-sometax-someterm.php. taxonomy-{taxonomy}.php: For example, if the taxonomy is named “sometax,” WordPress would look for a file named taxonomy-sometax.php taxonomy.php archive.php index.php url: /you_site.com/portfolio_category/term_name Provided … Read more

Display hierarchical subterms of custom taxonomy based on depth

I love a good challenge! The function here: function get_post_categories_sorted ( $post_id ){ $terms = wp_get_post_terms( $post_id, ‘category’ ); $sorted_terms = []; foreach( $terms as $term ){ $depth = count( get_ancestors( $term->term_id, ‘category’ ) ); if( ! array_key_exists( $depth, $sorted_terms ) ){ $sorted_terms[$depth] = []; } $sorted_terms[$depth][] = $term; } return $sorted_terms; } will give … Read more

Custom Taxonomy Archive BUG

as mentioned by @mmm you loop over the terms and in each term you loop over each project – however I think this is what you wanted to do: $terms = get_terms( array( ‘taxonomy’ => ‘residential_project_types’, ‘orderby’ => ‘count’, ‘hide_empty’ => true ) ); foreach( $terms as $term ) : ?> <a class=”property-thumb-link” href=”https://wordpress.stackexchange.com/questions/264897/<?php echo … Read more

How can I check if a taxonomy has more than one item?

And if you want to check if current post has more than one term in given taxonomy (it’s not very clear in your question and this version makes much more sense for me…), then function get_the_terms will come handy: $terms = get_the_terms( $post, $taxonomy ); echo ( count($terms) > 1 ) ? ‘Destinations’ : ‘Destination’;

Custom taxonomy query not working with switch_to_blog

I find the solution: Tax_query not working on multisite (I dont say, that I work with switch_to_blog, because everything is works fine with this function… everything, including postmeta queries, category__not_in, etc., but EXCEPT: tax_query) So, “you have to register that custom taxonomy in both blogs”. <– so the problem originate from the different themes, when … Read more

Adding Age Based WordPress Category

You might like to: Use a custom field as @Fayaz mentions above. Advanced Custom Fields will be the best for this (and you have it already). Add a new field (and I’d call it ‘Year of birth’) using Range. You could use a datepicker, but this way it’s cleaner and less intrusive: This will then … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)