0

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?

1
  • 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? Commented Oct 18, 2011 at 16:14

2 Answers 2

0

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
}
0
0

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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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