Support » Plugin: Simple Fields » [Plugin: Simple Fields] img tag still added if File Upload field blank

  • Hi there,

    I noticed that even if a File Upload does not have a file uploaded the plugin is still spitting out markup for img tag and this results in the typical broken image icon. I’m even using logic to check if the field is not blank but this doesn’t work:

    <?php
    									$field_id = get_post_meta( $post->ID, '_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0', true );
    									if($field_id != ''):
    							?>
    							<div class="editor-image">
    								<img src="<?php echo wp_get_attachment_url($field_id); ?>" />
    							</div>
    							<?php endif; ?>

    Any possibility of getting this fixed or is there an easy solution you can share?

    Thanks,
    Jonah

    http://wordpress.org/extend/plugins/simple-fields/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Pär Thernström

    (@eskapism)

    Can you paste the actual contents of $field_id? Maybe the output from
    var_dump($field_id);
    ?

    Nevermind, I figured it out, I just needed to check for it like this instead:

    <?php
    if ( $field_id = get_post_meta( $post->ID,'_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', true ) ): ?>

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Simple Fields] img tag still added if File Upload field blank’ is closed to new replies.