Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am creating a site and installed the More Fields plugin option to create custom fields in the posts.

I'll have an area for downloads, which will provide Word and Excel files to download.

If I create a field of type yes / no, as I call the code so that "If you marked YES" shows the image, and if you have marked as NO, hides the image.

Can anyone help me?

thank you

share|improve this question

1 Answer 1

Add a new "more field" radio button. For its value use *Show, Hide. The asterisk defaults to "Show".

PHP

$value = get_post_meta($post->ID, 'my_image', true);

if ( $value == 'Show' ) {
    echo '<img src="myimage.jpg">';
}
share|improve this answer
    
That's right, it worked correctly. Only two details, I had to create a checkbox, radio button using it will not let me use values​​. Thank you very much. –  user15269 Apr 28 '12 at 5:48
    
@user15269 Then please mark this as solution. This is the check mark on the left below the voting arrows. –  kaiser Nov 4 '12 at 16:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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