Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type that describes components of a product. As the product is developed new components are added. I'd like to define what version of the product the component was added, and then be able to browse products by that version.

I tried making a custom taxonomy as the version, but my problem is when I browse that version. I only see the components added for that version. I need to include all components for that version and previous versions.

Is taxonomies that right approach or is there another way to handle this in WP?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Taxonomies is not the right approach here, you should use custom fields (post meta) instead this way you can use compare argument of the meta query as <= ex:

$args = array(
        'post_type' => 'product',
        'meta_query' => array(
                array(
                        'key' => '_version',
                        'value' => '1.0',
                        'compare' => '<='
                )
        )
 );
$query = new WP_Query( $args );
share|improve this answer
    
thanks, that's why I couldn't figure it out. Didn't know it was referred to as meta. –  Mathew Foscarini May 26 '12 at 19:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.