• I’ve tried to make modifications to the slick-front-end.php file to get the alt tags to display in the html.

    $loop = new WP_Query($args);
    $images = array();
    $output = ”;
    while ($loop->have_posts()) {
    $loop->the_post();
    $image = get_the_post_thumbnail(get_the_ID(), ‘full’);
    if (!empty($image)) {
    $post_id = get_the_ID();
    $title = get_the_title();
    $alt = get_post_meta($img_id , ‘_wp_attachment_image_alt’, true );
    $content = get_the_excerpt();;
    $image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘full’);
    $image_src = $image_src[0];
    $url = get_post_meta(get_the_ID(), ‘slickc_image_url’);
    $url_openblank = get_post_meta(get_the_ID(), ‘slickc_image_url_openblank’);
    $images[] = array(
    ‘post_id’ => $post_id,
    ‘title’ => $title,
    ‘alt’ => $alt,
    ‘content’ => $content,
    ‘image’ => $image,
    ‘img_src’ => $image_src,
    ‘url’ => esc_url($url[0]),
    ‘open_blank’ => $url_openblank[0],
    );
    }
    }
    return $images;

    You can see where I have added the $alt function and then below that the ‘alt’ parameter in the array. And then for the display, further down in the code:

    <?php echo $linkstart ?>
    ” title=”<?php echo esc_html($image[‘title’]) ?>” alt=”<?php echo $image[‘alt’] ?>” />
    <?php echo $linkend ?>

    The alt tag is there, but remains empty. Any suggestions on getting this to generate my alt tag for the image?

  • The topic ‘Alt Tags Not Displaying’ is closed to new replies.