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?

  • 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

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

     case 'green':
         include('category-car-green.php'); // or just different CSS
     // etc

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


Something like:

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

    $additional_args = array(

    $args = $args + $additional_args;


$query = new WP_Query ( $args );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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