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 need this for menu "red car", "blue car", "green car".

Information is retrieving from a single category (cars). But the output on pages depending on the values ​​in the metaboxes (colors). On the page with blue cars shouldn't be a green cars.

Cars and colors for illustrative purposes only.

How can I do this?

share|improve this question
    
What sort of data are "red", "blue", and "green"? If "car" is the Category, are "red", "blue", and "green" Categories? Tags? Some Custom Taxonomy? Post Custom Meta? –  Chip Bennett Oct 18 '11 at 16:14
add comment

2 Answers

Make 1 template, and do a conditional on the meta info to either include a different stylesheet, or a entire different file altogether.

$colour = get_post_meta(the_ID(), 'color');
switch($color) {
     case 'red':
         include('category-car-red.php'); // or just different CSS
         break;

     case 'green':
         include('category-car-green.php'); // or just different CSS
         break;
     // etc
}
share|improve this answer
add comment
up vote 0 down vote accepted

I did it with $_REQUEST help. This is not very pretty solution because of ugly url, but it works.

http://example.com/?key=value

Something like:

if ( $_REQUEST['key'] == 'value' ) {

    $additional_args = array(
        'meta_key'=>'key',
        'meta_value'=>'value'
    );

    $args = $args + $additional_args;

}

$query = new WP_Query ( $args );
share|improve this answer
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.