Show Hide Post Information based on term clicked by user
Show Hide Post Information based on term clicked by user
Show Hide Post Information based on term clicked by user
Changing URL Parameters for Taxonomy in WordPress
After much searching, and lots of help here (thanks again, Sally CJ), this the code I ended up using. $category_terms = get_terms(array(‘taxonomy’ => ‘categories’)); $series_terms = get_terms(array(‘taxonomy’ => ‘series’)); $custom_post_type=”cpt”; foreach( $category_terms as $category_term ) { foreach ($series_terms as $series_term) { $args = array( ‘post_type’ => $custom_post_type, ‘showposts’ => ‘5000’, ‘meta_key’ => ‘available_date’, ‘tax_query’ => … Read more
wp_get_object_terms() returns the terms associated with an object (eg a post or a page or custom post) as text (normally in an array). From the Codex page for wp_get_object_terms() $productcategories = wp_get_object_terms($post->ID, ‘productcategories’);
how putting a “null position” in a taxonomy dropdown selector
because is_archive is earlier so it doesn’t evaluate the others, it’s checked from the top down and since is_archive is super generic it will be true for all archives, categories, tags, dates, etc etc. You need to go from the most specific to the least specific, not the other way around. Think of it like … Read more
I found a solution for this: <?php $current_term_id = get_queried_object_id(); $taxonomyName = “car-brand”; $parent_tax_ID = $current_term_id; $parent_tax = get_term($parent_tax_ID); $terms = get_terms( $taxonomyName, array( ‘parent’ => $parent_tax_ID, ‘orderby’ => ‘slug’, ‘hide_empty’ => false ) ); foreach ( $terms as $term ) { $image2 = get_field(‘am-brand-img’, $term); echo ‘ <div class=”am-ts-item”> <a href=”‘ . get_term_link( $term … Read more
Creating a page that will dynamically get posts from 2 taxonomies
According to this change, in version 6.3 WordPress was updated to support emptying the terms assigned to a post by passing an empty value in a way that won’t cause an error in PHP 8.1+. PHP treats ‘0’ as empty, so your code is treated as setting no terms on the post. If you want … Read more
This is a VERY untested approach, but the recent addition of CSS’s :has selector has been top-of-mind for me lately, and I wondered if a simple solution could be built using purely CSS.. As a proof of concept, add the following to your site’s admin CSS: #categorychecklist > li .children{display:none;} #categorychecklist > li:has(input:checked ) .children{display:block;} … Read more