WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
If get_field Equals False (2 posts)

  1. bmc1416
    Member
    Posted 1 year ago #

    I'm trying to replace an image with a gravatar if the image in the custom field returns false(or does not exisit)

    So I've set my variable

    <?php $thumb_image = get_field('thumb_image'); ?>

    What is the value if there is no image in the custom field thumb_image? This is not working

    <?php if ($thumb_image == false) : ?>
     <?php echo get_avatar( get_the_author_meta('ID') ); ?>
    <?php endif; ?>

    http://wordpress.org/extend/plugins/advanced-custom-fields/

  2. elliotcondon
    Member
    Plugin Author

    Posted 1 year ago #

    have you tried to debug the variable?
    Use the var_dump function to see what the value is

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic