Conditional w/ radio and checkboxes
-
I have a conditional statement which only shows data if the user selected items in a checkbox list. I have another section that does this for radio buttons.
The problem I’m having is when I try to display the data on the front end (if the user selected any checkboxes), it just outputs the word “array”. Here’s my code:
<?php if (!((get_post_meta($post->ID, 'wpcf-exterior-types', TRUE))=='')) { echo '<p><strong>Exterior Types: </strong>'.get_post_meta($post->ID,'wpcf-exterior-types',TRUE).'</p>'; } ?>
How can I write the code so that it will only echo the above code if the user selected any checkbox data?
The problem I’m having with the radio buttons is a little different. It just outputs either “1” or “2” depending on if the user selected “yes” or “no” radio in the back end. When creating the custom meta field, I even tried changing the values that showed either 1 or 2, to the actual words “yes” and “no”, but it still shows 1 or 2 on the front end. Here’s my code for that:
<?php if (!((get_post_meta($post->ID, 'wpcf-foreclosure', TRUE))=='')) { echo '<p><strong>Foreclosure: </strong>'.get_post_meta($post->ID,'wpcf-forecosure',TRUE).'</p>'; } ?>
Any ideas on either of these two issues?
- The topic ‘Conditional w/ radio and checkboxes’ is closed to new replies.