Support

Account

Home Forums General Issues Echo image title text

Helping

Echo image title text

  • How do I spit out the title of an image in the media library where my code scenario is as follows… ?

            <?php
            if( get_row_layout() == 'logos_row' ): ?>
              <!-- logos row -->
              <div class="row d-flex justify-content-center <?php the_sub_field('logos_colour'); ?>">
                <?php
                // check if the repeater field has rows of data
                if( have_rows('logos') ):
                  // loop through the rows of data
                    while ( have_rows('logos') ) : the_row();
                        // display a sub field value
                        ?>
                        <div class="col-6 col-sm-4 col-md-3 col-lg-2 col-xl-2 align-self-center pb-5"><?php if (!empty(get_sub_field('logo_link'))) { echo '<a href="' . get_sub_field('logo_link') .'">'; } ?><img class="img-fluid" src="<?php the_sub_field('logo_image');?>" alt="alt text"><?php if (!empty(get_sub_field('logo_link'))) { echo '</a>'; } ?></div>
                    <?php
                    endwhile;
                endif;
                ?>
              </div>
            <?php endif; ?>
  • Curious if anyone has any thoughts, please.

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

The topic ‘Echo image title text’ is closed to new replies.