Advanced Custom Fields
If get_field Equals False (2 posts)

  1. bmc1416
    Posted 3 years 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; ?>


  2. elliotcondon
    Plugin Author

    Posted 3 years 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

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic