Lego2012
12/13/2016 - 2:44 PM

if alt text exists

if alt text exists

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

// if the image has alt text set, set $alt_text variable to that else to the Page title
               if( ! empty( $image['alt'] ) ) {
                  $alt_text = $image['alt'];
               } else {
                  $alt_text = get_the_title();
               }