WordPress.org

Ready to get started?Download WordPress

Forums

Simple Fields
img tag still added if File Upload field blank (3 posts)

  1. jonahcoyote
    Member
    Posted 3 years ago #

    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/

  2. Pär Thernström
    Member
    Plugin Author

    Posted 3 years ago #

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

  3. jonahcoyote
    Member
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic