I like to do a simple thing with my custom meta box, but i d'ont find a (easy) solution for this problem.
I have done a custom post type with some meta boxes => text, textarea, select fields, ect.
all work just fine. Now if i set the button to sold,(see code excerpt from the radio array below) the text(div) should be red; if i set it to for_sale, it should be green.
but i have no idea how to do this, i mean there are this two states possible. nothing else. and that is what i want. but the html output is only text. or text in a html-tag, this i can style with css, but it would be red, or it is blue, green what else i sett it. is there a simple thing, like a class to set for each value? i c'ant find an answer. i hope i have explained it understandable. thanks so much for taking time for this.
array(
'label' => 'Status',
'desc' => 'product status',
'id' => $prefix.'radio_status',
'type' => 'radio',
'options' => array (
'one' => array (
'label' => 'Product for sale',
'value' => 'for_sale'
),
'two' => array (
'label' => 'Product is sold',
'value' => 'is_sold'
),
),
),
EDIT :)
<span class="saleBox"><span class="noBox"><?php echo $post_meta_data['custom_radio_status'][0]; ?></span></span>
Thats the HTML, and what i get is the value thats setted.
<span class="saleBox"><span class="noBox">for sale</span></span>
or then: *soled
So i need a Output with a true-value, or class, ID,... something that i can adress with css.
A good idea that works. only thing that i doesen't understand is, is must call the array.
<?php $post_meta_data = get_post_custom($post->ID); ?>
if i call only the specific data:
<?php get_post_meta($post->ID, 'custom_radio_status', true) ?>
for me, it won't. or i made a typo. it doesen't matter i works!
thank you mr. Maguire
Put a conditional statement, something like: