Support

Account

Home Forums General Issues Display a specific image if my field is empty or not

Helping

Display a specific image if my field is empty or not

  • Hello,
    With the plugin, I created two text fields in which you enter an url .
    field1 : telecharger_sur_app_store
    field2 : telecharger_sur_play_store
    As a result , I get the value of the field and I assign them a css class to display an image A for ” telecharger_sur_app_store ” and an image B for ” telecharger_sur_play_store ” (i’m using css class to display my images) .

    my code :

    <div class="entry-thumb">
         <img src="<?php echo $article_image ?>" alt="<?php the_title(); ?>"/>
              <span class="hover-box">
                      <a href="<?php the_field('telecharger_sur_app_store'); ?>" target="_blank" class="appstore-link"></a>
                      <a href="<?php the_field('telecharger_sur_play_store'); ?>" target="_blank" class="playstore-link"></a>
              </span>
    </div>

    This code works well.
    However I would like to display other images that correspond to the fact that the fields are empty.
    if in admin fields 1 : is not specified (is empty), then I display:
    css class = ” appstore-empty-link”.
    and
    if in admin fields 2 : is not specified (is empty), then I display:
    css class = ” playstore-empty-link”

    How can I do that?
    Great thank you for your help!

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Display a specific image if my field is empty or not’ is closed to new replies.