How to share terms between two taxonomies?
Now when you give more than 1 category to a post, you can tell directly in the category which one is the main one and it will be used for the URL.
Now when you give more than 1 category to a post, you can tell directly in the category which one is the main one and it will be used for the URL.
I think this is what you are searching for… You must use both post_type and tax_query to filter your query $query = new WP_Query( array( ‘post_type’ => ‘books’, // name of post type. ‘tax_query’ => array( array( ‘taxonomy’ => ‘fiction’, // taxonomy name ) ) ) ); while ( $query->have_posts() ) : $query->the_post(); // do … Read more
Check your custom post type and custom taxonomy arguments arrays and make sure ‘show_in_rest’ is set to true in both.
global $post_meta_data; $city = houzez_taxonomy_simple(‘property_city’); $city_url = “http://krieta.com/city/”.$city; $google_map_address = get_post_meta( get_the_ID(), ‘fave_property_map_address’, true ); $google_map_address_url = “http://maps.google.com/?q=”.$google_map_address; if( !empty($city) ) { ?> <div id=”city” class=”detail-city detail-block target-block”> <div class=”detail-title”> <h2 class=”title-left”><?php esc_html_e( ‘About’, ‘houzez’ ); ?> <strong> <a target=”_blank” href=”https://wordpress.stackexchange.com/questions/275607/<?php echo esc_url($city_url); ?>”><?php esc_html_e($city ); ?></a></strong> <?php esc_html_e( ‘City’, ‘houzez’ ); ?></h2> <?php if( … Read more
This one has tripped me up in the past. If you have a collision between a taxonomy and post type rewrite, it’s important that you register the taxonomy before the post type. Assuming you’d be ok with reworking your reviews URLs to the format /reviews/%niche%/%postname%, you’d need to change your post type as follows: ‘rewrite’ … Read more
If it is an information about a user (probably displayed on on profile pages, or other user centric places), use user meta. If it is a way to have a collection of users….. hmmm wordpress sucks in this. Best option is probably to add a relevant role. Taxonomies in general are geared toward creating collection … Read more
Use the Taxonomy_Parameters in WordPress WP_Query like that: $args = array( ‘posts_per_page’ => 6, ‘post__not_in’ => $do_not_duplicate, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘art’, ), array( ‘taxonomy’ => ‘country’, ‘field’ => ‘slug’, ‘terms’ => ‘france’, ), ), ); $myposts = get_posts($args); you can add the “country” … Read more
Yes! Register a taxonomy. I usually call it something like “Promotions.” (this allows for more to be added easily in the future) From there, create the term “featured.” In your template, uses wp_query to display your featured articles, taxonomy parameters
Confused about category.php template – not working
field parameter of tax_query must be one of ‘term_id’, ‘name’, ‘slug’ or ‘term_taxonomy_id’. In your case it will be ‘term_id’, which is also the default value. https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters