rewrite URL based on selected taxonomy for post page
rewrite URL based on selected taxonomy for post page
rewrite URL based on selected taxonomy for post page
ACF: how do I get the fields and its values of a specific group?
Removing taxonomy query by pre_get_posts
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
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
I would advise against the use of year as a post type or taxonomy name as its a reserved term and your rewrite rule may clash For a list of reserved terms see here Steps to take: Modify the URL rewrite so it doesn’t clash Change the name of the taxonomy from year to something … Read more
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
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
The field parameter in the tax_query should be set to slug as it seems that you are passing the term slug. Any value passed to field except slug or name will cause the field parameter to default to term_id. Always remember, the value passed to field should match the what is been passed to terms, … Read more
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