I have a lot of custom taxonomies for my WordPress site. What I want to do is to Get Related Custom Taxonomies based on a Category. Sample Structure: (Material, OS and Features are Custom Taxonomies.) Post Category (CT)Material (CT)OS (CT)Features P1 A iOS OLED P2 B Metal GPS P3 C Glass Anroid GPS So what I want: For Category A: its related taxonomies is OS and Features. For Category B: its related taxonomies is Material and Features. For Category C: …
Im working with custom post types - named 'Products' I have multiple taxonomies registered - 'Category' and 'Dosage' And I'm trying to setup pages that only display custom post types 'products' IF taxonomy Category='injectors' AND Dosage='1ml, 2ml, 5ml' I hope that makes sense - manage to get custom post archives working fine for a single taxonomy, but not sure about filtering by multiple. Cheers, This is the code i'm trying to get work but it doesn't <?php $myquery['tax_query'] = array( …
I'm attempting to display a list of all posts from multiple categories (if anyone answers this, you might want to include combining tags as well, as probably that will make this answer comprehensive for future seekers). Here's what I'm working with: This function works to show a list: function my_custom_loop_three_posts($category, $tag, $offset) { $args=array( // showposts has been replaced, use 'posts_per_page' instead // 'showposts' => 1, 'posts_per_page' => 3, // this has been replaced, use 'ignore_sticky_posts' // 'caller_get_posts' => 1, …
I have subcategories(custom taxonomy).I want to fetch all products of that category in one table & then other category name & it's table. To achieve this,I grouped by & ordered by custom taxonomy.Also, I want to pass parent category (custom taxonomy) id to the query. But when I pass these 2 conditions at a time , no data is returned. /* to order by taxonomy*/ function orderby_tax_clauses( $clauses, $wp_query ) { global $wpdb; if ( isset( $wp_query->query['orderby'] ) && 'product_category' …
How do I, in a wp_query, get all the posts where 2 taxonomies do not have the same values? for example i have a taxonomy of widths and one of heights and I want to, for one query, pull all the posts that have different values for width and height.
ok, i have a custom post type LAW and two taxonomy LAW TYPE and EDITION I create a page taxonomy-law_type.php for display child terms LAW TYPE <ul class="wpb_page_list"> <?php $term = get_queried_object(); $children = get_terms( $term->taxonomy, array( 'parent' => $term->term_id, 'hide_empty' => false ) ); if ( $children ) { foreach( $children as $subcat ) { echo '<li style="display:flex"><a href="' . esc_url(get_term_link($subcat, $subcat->taxonomy)) . '">' . // wrapped $subcat->name . ' (' . $subcat->count . ')' . '</a></li>'; } } …
On the project there is a filter: It should filter the custom post ty recipes. Selected items are checkboxes. So, several values for filtering can be selected at any time. But in my case, filtering works only on one selected element. For example, I chose 'Lorem inpus1' the recipes were filtered by it. Now I choose any other element 'Lorem inpus3' for example and previous results removed. Here is my code. I think the reason is in it, but I …
I've two category employee and full-time. If a post publish in both (employee and full-time) category then the post will show in his specific section. If post has only employee category, not full-time or has only full-time, not employee, then this post will not show in the post block. How can I do this? What will be the query of this relationship between two category?? Here is my code - 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'category', …
I need to build a complex query. I want to display all posts, and 2 different CPT posts in specific taxonomies. All of these posts need to have been checked to be displayed. The checkbox is added with ACF. My ACF checkbox is named highlight and the value needs to be yes. So my query should display: all posts of all categories but with the ACF checkbox checked all post of the CPT1 with the taxonomy TAX1 and ACF checkbox …
How to list out all the terms of a custom taxonomy that are relative in another custom taxonomy? I am creating a filter page for a CPT with multiple custom taxonomies. Please see the screenshot below: Custom Post Type: English "cpt_english" Custom Taxonomy: Courses Terms: course-a, course-b, course-c Custom Taxonomy: Difficulties Terms: easy, advanced , pro Custom Taxonomy: Tasks "tasks" Terms: task1, task2, task3, task4 The screen is html markup, not php generated code. Question: How can I list out …
Here's the code I'm using to try and query a single taxonomy for one term, but exclude returned posts for that term that also belong to another. In English, this is what I want: query 'resource-type' for 'testimonies', but not 'testimonies' that are also 'audio'. Tips to tweak this code to get it to work? <?php $testimonials_args = array( 'post_type' => 'resource', 'posts_per_page' => 1, 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'resource-type', 'field' => 'slug', 'terms' => …
This is an extended question from Permalink for CPT with taxonomy I am building a website that has a CPT and a few custom taxonomies. Each single CPT post is basically "a question" for student to practice with. I would like to setup a "taxonomy filter page", so user can quickly find the one they are looking for in the right categories. I am creating a "CPT & Taxonomy filter" page to serve this purpose. Note that the CPT archive …
I would like to show an archive of posts that have two taxonomy terms in common. So for example, I'd like to show all posts that have both the terms "sauce" and "cheese" in the custom food taxonomy. The trick is that I'd like to do this using the url. The closest I've come is with: example.com?food[]=sauce&food[]=cheese Upon inspecting the $query from the pre_get_posts filter, I can see that: WP_Tax_Query::__set_state(array( 'queries' => array ( 0 => array ( 'taxonomy' => …
I created a filterable gallery with ACF. My problem is that when I add a project to which I add several taxonomies, in my gallery I have the project as many times as I have added taxonomies. Apart from that, I would like the project to appear only once in the gallery but to appear in all the filters where the taxonomy is selected. <div id="filters" class="col-3"> <ul class="nav"> <li data-filter="all" class="filter active">Tous les projets</li> <?php // 1. On définit …
I need to make a shortcode that uses the values of four different taxonomies. I am trying to modify code that I have used to query attachments (in media) based off of multiple taxonomy terms, but what I need is to wp_query based off of 4 (four) taxonomies values. I realize that I am way off, but perhaps somebody can help put me on the right track. The Four taxonomies are: media_language media_document_category mp_industry mp_product_lines I want to use a …
I have two taxonomies for my property post type: property-style which has terms for different home styles like "Country" and "Modern", and property-tag which has terms for amenities such as "Swimming Pool" and "Garage". On the main page I list all of the property-style terms with the post count: Classic [1 Post] Country [0 Posts] Modern [4 Posts] Rustic [3 Posts] I get these terms by using: $terms = get_terms( array( 'taxonomy' => 'property-style', 'hide_empty' => false, 'orderby' => 'name', …
I want to limit the number of categories to be displayed on girds to be 4 or something like clickable to expend all. but this should not be the effect on single post page. Thanks
I used the "Custom Post Types UI" and "Custom Fields" plug-ins to set up my structure. I have a custom post type called "artwork". This works fine. Posts have URLs like domain.cc/artwork/title-of-some-random-artwork. When I enter domain.cc/artwork, I get an archive page with all posts of the post type "artwork". That's how it should be. Within the "Artwork" post type, I have taxonomies for "Artist", "Movie" and "Company" (connected to custom fields which can be filled in when I entered a …
I'm trying to do tax_query for posts that have a term1 in taxonomy1 AND a term2 in taxonomy2 if I do: 'tax_query' => [ 'relation' => 'AND', [ 'taxonomy' => 'taxonomy1', 'terms' => 'term1', ], [ 'taxonomy' => 'taxonomy2', 'terms' => 'term2', ], ], I get all post with term1 in taxonomy1 AND all post with term2 in taxonomy2. I want the posts containing both terms: term1 and term2. Thank you. [EDIT. ACTUAL CODE] First, I recover al terms of …