• Resolved luisdesousa

    (@luisdesousa)


    Hello!. Thank you very much for this wonderful plugin. I have a problem. I can’t find a way to add the “alt” attribute to the images in the carousel. In the Advanced tab the Attributes section is not available (in which the alternative text for each image should be added). This is a very important attribute for the SEO of the page. Thank you for any help you can offer me. Best regards

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter luisdesousa

    (@luisdesousa)

    Hello!. To temporarily solve this issue (while the developers provide a proper solution) I modified the code in the “/wow-carousel-for-divi-lite/includes/modules/ImageCarouselChild/ImageCarouselChild.php” file. I added the following instructions:

    $image_url = sprintf('%s', $photo);
    $post_id = attachment_url_to_postid($image_url);
    $alt_text = get_post_meta($post_id, '_wp_attachment_image_alt', true);
    return sprintf(
    	'<figure class="wdcl-lightbox-ctrl">
    		<div class="wdcl-overlay" data-icon="%2$s"></div>
    		<img class="wdcl-main-img" data-mfp-src="%1$s" src="%1$s" alt="' . $alt_text . '"/>
    	</figure>',
    	$photo,
    	$overlay_icon
    );

    In substitution of those that appear between lines 314-321.

    This modification allows to use the alternative text that is added to each image in the media library

    Best regards

    anonymized-14942572

    (@anonymized-14942572)

    Thanks Luis! I have included the title image to your code. They should include this in the next plugin update.

    $image_url = sprintf('%s', $photo);
    $post_id = attachment_url_to_postid($image_url);
    $alt_text = get_post_meta($post_id, '_wp_attachment_image_alt', true);
    $title_photo_text = get_the_title($post_id);
    return sprintf(
    	'<figure class="wdcl-lightbox-ctrl">
    		<div class="wdcl-overlay" data-icon="%2$s"></div>
    		<img class="wdcl-main-img" data-mfp-src="%1$s" src="%1$s" alt="' . $alt_text . '" title="' . $title_photo_text . '"/>
    	</figure>',
    	$photo,
    	$overlay_icon
    );

    Thanks for the info. Do we know when the next plugin update might be?

    Thanks.

    • This reply was modified 1 year, 8 months ago by Tig2021.
    • This reply was modified 1 year, 8 months ago by Tig2021.
    • This reply was modified 1 year, 8 months ago by Tig2021.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘I can’t add alt attribute to images’ is closed to new replies.