is_tax() function not working as expected

If you take a look at this part of the WP_Query class: switch ( $tax_query[‘taxonomy’] ) { case ‘category’: $this->is_category = true; break; case ‘post_tag’: $this->is_tag = true; break; default: $this->is_tax = true; } then it looks like on category archive pages where is_category gives true then is_tax is false. So it looks like you … Read more

Filter custom post type using multiple taxonomy dropdowns

Right, seems a little empty here but I figured out the problem myself, again. The trick was to have empty values in the $output variables. So $output .=”<option value=””>Select taxonomy #1</option>”; NOT $output .=”<option value=”#”>Select taxonomy #1</option>”; This is how you can create two dropdown menus and filter out your posts using your custom taxonomies. … Read more

Error sending array of inputs

As I said in a comment above, setting query_var => false for the custom taxonomy is not a solution because this will make term pages in frontend return a 404 error. Renounce to term pages in the frontend to make a simple form to work is far away to be a solution. Finally I’ve solved … Read more

Get posts of ONE taxonomy term of custom post type

You can try making the $args array more specific with: $args = array( ‘post_type’ => ‘portfolio’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘locations’, ‘field’ => ‘slug’, ‘terms’ => ‘paris’ ) ) ); Grabbed this snippet similar to one on the WP Query page in the codex. Also, this is assuming that your custom post type … Read more

Order custom Taxomony alphabetically and reversal after clicking a button?

Pass order parameter in url on click on link like /?order=DESC or if you are using a button then it must be submitting a form with order field value change GET to POST and field name if(isset($_GET[‘order’])){ $order = $_GET[‘order’]; } else{ $order=”ASC”; } $categories = get_terms( ‘category’, array( ‘orderby’ => ‘name’, ‘order’=> $order, ) … Read more

get_terms that have custom sticky field checked

OK, got it <?php $types = get_terms( ‘tvr_amenity’, array( ‘parent’ => ‘0’, ‘hide_empty’ => 1 ) ); foreach( $types as $type ) : $myname = trim($type->name); $meta = get_option(‘amenity_sticky’); if (empty($meta)) $meta = array(); if (!is_array($meta)) $meta = (array) $meta; $meta = isset($meta[$type->term_id]) ? $meta[$type->term_id] : array(); $value = $meta[‘is_sticky’]; if(!$value) continue; /* skip term … Read more