Custom Post Type Taxonomy Filters

I would take a look at this page on the Codex: http://codex.wordpress.org/Class_Reference/WP_Query I think you need to override your query_posts() for your landing page, and controlling different queries with if() statements, depending on what areas of a form (guessing you’re using a form?) has filled in. For example: // Carry pagination through $args = array( … Read more

Get posts by term slug only

If you look at source of get_term() it does hard check for taxonomy and for good reasons (caching, collisions, etc). I see two possible approaches: look for term in every appropriate taxonomy until you match try to query for term by search or name__like in multiple taxonomies using get_terms() and work with results

How do I taxonomy terms based on terms they are used alongside?

So my solution on this kind of problems where we have a very complex set of rules is to avoid doing new SQL just for my solution because if you have to explain it to a beginner it gets hairy. My solution: function get_term_union( $taxonomy, $tax_query, $post_type=”post” ){ $args = array( ‘post_type’ => $post_type, ‘tax_query’ … Read more

Custom post type templating problem

Archive pages A & B already exist as your brand and type term archives, you can style those differently by creating taxonomy-brand.php and taxonomy-type.php templates. The remaining piece is two different single product views. The simplest way to achieve that would be to append a GET var onto the permalinks: http://domain.com/product/someproduct/?origin=brand http://domain.com/product/someproduct/?origin=type WordPress has the … Read more

get_the_terms error

I ended up using the wp_get_object_terms() function instead of get_the_terms(). The get_the_terms() function attempts to cache the terms where wp_get_object_terms() does not. The fixed code to get the hero images CPT’s ID is: $hero_image_id = ( $assigned_hero_images = wp_get_object_terms( $post_parent, ‘hero_images’ ) ) && ( $hero_image = array_shift( $assigned_hero_images ) ) && isset( $hero_image->term_id ) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)