Articles of advanced taxonomy queries

Display sub categories and their data of a taxonomy

I want to output the sub category details of a taxonomy $getTerms = get_terms($taxonomy, $args); print_r($getTerms); When i print the above out it returns the object. But theres no value difference between parent and sub categories. The first is a parent taxonomy and the second is a sub-category. [1] => stdClass Object ( [term_id] => […]

How to convert query sql to shortcode in wordpress?

I want to make a shortcode like this [myshorcode:2:drinks], and query-wrangler I have managed to get the following query that shows me 2 products of a certain taxonomy PHP WP_Query: $query = array ( ‘paged’ => 1, ‘posts_per_page’ => ‘2’, ‘offset’ => 0, ‘post_status’ => ‘publish’, ‘ignore_sticky_posts’ => 0, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, […]

How to have multiple instances of the same taxonomy in a search form

I’m trying to have two separate search fields for tags on a search page on my WordPress site, but it seems have a duplicate instance of a taxonomy breaks the search functionality. <form method=”get” id=”search form” action=”/”> <div> <input type=”text” value=”” name=”tag” id=”tag” /> <input type=”text” value=”” name=”tag” id=”tag” /> <input type=”hidden” value=”94″ name=”cat” id=”scat” […]

I have custom post type with custom taxonomy. But not found the taxonomy page..

this is my link. http://redesign.conei-sa.com/apps_cat . not found . My code in function.php. function prefix_register_post_type() { register_post_type( ‘application’, array( ‘labels’ => array( ‘name’ => __(‘Application’, ‘text_domain’), ‘singular_name’ => __(‘Application’, ‘text_domain’), ‘menu_name’ => __(‘Application’, ‘text_domain’), ‘name_admin_bar’ => __(‘Application Item’, ‘text_domain’), ‘all_items’ => __(‘All Items’, ‘text_domain’), ‘add_new’ => _x(‘Add New’, ‘prefix_portfolio’, ‘text_domain’), ‘add_new_item’ => __(‘Add New Item’, […]

Fetch all terms for an array of posts

I need to fetch all terms associated with an array of posts. I can loop over each post and do a seperate get_terms or wp_get_post_terms query for each post but that seems like a really slow way of doing it. (In terms of DB execution time). Is there some clever trick that I use to […]

get all posts associated with a custom taxonomy

Looks like the advanced tax query options in WordPress does not allow the following query: Get me the most recent posts but only those posts that have at least one term under the taxonomy I’m interested in ( here the key thing is “any term” under that taxonomy would be OK to qualify that post […]

Using Advanced Custom Fields Relationship Field to select a taxonomy term

I have a site where I’ve got a post type called ‘small banners’ which are basically adverts that i need to call on normal pages (This is fine, I’ve done this) but I also need to use this functionality on a Taxonomy term. ACF doesn’t have the functionality to select taxonomy terms themselves just to […]

Getting taxonomy category Image from ACF

I’m really new to php and I’m trying to get an image set using advanced custom fields on my front end. I’ve looked at the docs and forums but I can’t get the url. All the code works but for the image. I expect the url value to show up but instead I get a […]

Show only the sub-categories (and their content) of the current custom taxonomy with 'taxonomy.php'

So, I need to show a page with the sub-categories of the current custom taxonomy, with their respective posts inside. What I need is, when I click on a sub-cat link, I get something like: ‘Tipos’ (custom taxonomy) – Auto (first sub-cat) – Sub-Item 1 (first sub-sub-cat) – Post 1 – Post 2 – Sub-Item […]

How to add images to taxonomy terms?

This question already has an answer here: How to associate an image with a term taxononmy and publish it on frontpage? 5 answers