Tag Info

New answers tagged

1

I may suggest not combining each of these into hierarchical taxonomies, but setting up 3 distinct taxonomies. It seems like they are 3 unrelated properties of the photos, and thus, I would separate the code for them. Then you're not trying to code around nested taxonomy terms, but you can access them each individually. The taxonomies would be color, location ...


1

When you are on a taxonomy page, you can get the parent from the term being displayed by using the following code with get_queried_object. See get_terms for the objects that are returned $queried_object = get_queried_object('term'); $term = $queried_object->parent; To get the taxonomy, you can simply just add $tax = $queried_object->taxonomy; ...


2

There is no way easy way to do that. You have to query directly to achieve that. I am assuming, you only want the parent categories which don't have descendants or even if they have descendants, it's not used in any post global $wpdb; $categories = $wpdb->query("SELECT $wpdb->terms.* FROM $wpdb->terms ...


1

Your code is correct, well almost correct. On first view, I must confess, I missed it too. You have two syntax errors in your code. If you look closely, 'parent ' and 'parent' is not the same. You should not leave blank spaces between single quotes (') and arguments. Also, you don't need to add a , after your last argument. This should work $cat_args = ...


0

Why don't you use "parent" parameter of get_terms $page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1; // number of tags to show per-page $per_page = 24; $offset = ( $page-1 ) * $per_page; $args = array( 'number' => $per_page, 'offset' => $offset, 'hide_empty' => 1,'hierarchical ' => true, 'parent'=>'term_id of Indigenous ...



Top 50 recent answers are included