Support

Account

Forum Replies Created

  • Thanks Jonathan, this worked great for me when I have the “object” or “array” option selected:

    
    <?php
      $hdr_image = get_field('hdr_image');
    ?>
    <?php if( !empty( $hdr_image ) ): ?>
      <img src="<?php echo esc_url($hdr_image['sizes']['thumbnail']); ?>" alt="<?php echo esc_attr($hdr_image['alt']); ?>" class="img-responsive">
    <?php endif ?>
    

    Of course, you’ll have to change “thumbnail” to your desired default size or the custom size you registered on your functions.php

    Thanks again 🙂

    PS. It’s important to remember that if you registered a custom size after you uploaded an image, you’re going to have to regenerate your thumbnails.

  • Thanks Jonathan, this worked great for me when I have the “object” or “array” option selected:

    
    <?php
      $hdr_image = get_field('hdr_image');
    ?>
    <?php if( !empty( $hdr_image ) ): ?>
      <img src="<?php echo esc_url($hdr_image['sizes']['thumbnail']); ?>" alt="<?php echo esc_attr($hdr_image['alt']); ?>" class="img-responsive">
    <?php endif ?>
    

    Of course, you’ll have to change “thumbnail” to your desired default size or the custom size you registered on your functions.php

    Thanks again 🙂

    PS. Remember that if you registered the image size after you uploaded the image it’s probably not working because you have to regenerate the thumbnail images.

  • OK, forget the “if” statement for now and don’t use the “esc_url”.

    I’m using a repeater field and this worked for me:

    <?php if( have_rows('lista_de_encuestas') ) : while ( have_rows('lista_de_encuestas') ) : the_row(); ?> 
      <?php  
        $pollUrls = get_sub_field('enlace_a_encuesta');
      ?>
        <li>
          <a href="<?php echo $pollUrls['url']; ?>"><?php echo $pollUrls['title']; ?></a>
        </li>
    <?php endwhile; endif; ?>

    Not sure if the if statement has something to do with it. I tried the same thing over and over and for some reason when I deleted everything and did it over again it worked. I triple checked the code before and I don’t think I had any typos or errors but… who knows :/

    Hope this helps

  • I’m using a repeater field and this worked for me:

    <?php if( have_rows('lista_de_encuestas') ) : while ( have_rows('lista_de_encuestas') ) : the_row(); ?> 
      <?php  
        $pollUrls = get_sub_field('enlace_a_encuesta');
      ?>
        <li>
          <a href="<?php echo $pollUrls['url']; ?>"><?php echo $pollUrls['title']; ?></a>
        </li>
    <?php endwhile; endif; ?>

    Not sure if the if statement has something to do with it. I tried the same thing over and over and for some reason when I deleted everything and did it over again it worked. I triple checked the code before and I don’t think I had any typos or errors but… who knows :/

  • hahahaha… Still no answer huh?
    I’m having the same problem and I can’t seem to find the answer.

    Did you ever solved this?

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