Hi chaps,
In Custom Field Template I have this set up:
[Colors]
type = checkbox
value = Blue # Yellow # Black # White
A post can have multiple colors, so how can I display those?
For instance: Color: Blue, Black, White
Thx ahead guys :)
Hi chaps,
In Custom Field Template I have this set up:
[Colors]
type = checkbox
value = Blue # Yellow # Black # White
A post can have multiple colors, so how can I display those?
For instance: Color: Blue, Black, White
Thx ahead guys :)
You should edit your template.
Add some element, div for example, in template. Assign background-color for in with custom field value.
Insert this code in your theme
<div style="width:50px; height:50px; background-color: [INSERT HERE cft code];"></div>
Further to Alexey's solution:
<?php
$colour = 'White'; // set a default
$colour = get_post_meta( $post->ID, 'Colors', true ); ?>
<div style="width:50px; height:50px; background-color:<?php echo $colour ?>"></div>Thanks for sharing this.
How is it possible to get the title as well? For example, in the above mentioned example, displaying the following (if the colors are selected):
Colors: Blue, Yellow, Black, WhiteYou must log in to post.