Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #1486519
missing alt description for images in gallery
Closed

Comments

  • mc_kugelfang started the conversation

    Hi guys! Thnks again for your help with another ticket :)

    I'm still working on a relaunch of my site and using this theme on a copy of the site via XAMPP to get the redesign done and just switch everything afterwards…

    Yet, I got 1 issue though:

    I noticed that the alt descriptions of the images seem to be missing when I have added a gallery into a post (see image)

    I’d appreciate any help :)

  •  2,700
    PenciDesign replied

    Hi,

    By default, wordpress doesn't auto create alt for images. You need to add it for yourself.

    Check more on this image.

    Best Regards,

    PenciDesign

  • mc_kugelfang replied

    Hi and thanks for your answer.

    A missing alt-description doesnt seem to be the issue though, as I have added alt descriptions to all images beforehand in the media library. (See both images: alt desc. on image added w/o gallery gets shown (2.jpg), image in gallery doesnt... yet, there is an alt-attribute (but empty) in the img-tag (1.jpg)). The "= 'alt desc'" after the alt-attribute is missing on all gallery images.

  •  2,700
    PenciDesign replied

    Hi,

    If you mean set a caption of that images, you need to set it via caption box like on image I sent you.


    Best Regards,

    PenciDesign

  • mc_kugelfang replied

    No, I mean a missing alt-description. I just deactivated all plugins non-related to this theme to make sure that there is no interference.

    1. I added an alt-description on all images. (already did before) (see image)

    2. added a gallery

    3. checking the image of a gallery out: no set alt-attribute (see image)

  •  2,700
    PenciDesign replied

    Hi,

    Yeah, I understand it now.

    To fixed it, please replace this code like on this image to this code:

    $output .= wp_get_attachment_image( $imagePost->ID, 'penci-masonry-thumb' );

    Best Regards,

    PenciDesign

  • mc_kugelfang replied

    thanks, i will take a look

  • mc_kugelfang replied

    Hi & thanks for your answer,

    I think it partly did the job, yet, now I have 2 different issues resulting from this (see images):

    1. The justified gallery adds the alt-description as caption (this shouldn't be the case though - I haven't added a caption) -> image1

    2. The grid gallery adds medium images instead of the correct ones -> image2+image3


    I did a little tinkering now myself and changed a few lines (below, marked with /*TODO2*/).:

    --------------------------------------------------------------

    if( $posts ) {
    foreach ( $posts as $imagePost ) {
    $caption = '';
    if( $imagePost->post_excerpt ):
    $caption = $imagePost->post_excerpt;
    endif;
    if( $imagePost->_wp_attachment_image_alt ):
        $alt = $imagePost->_wp_attachment_image_alt;
    endif; /*TODO2*/
    $get_full = wp_get_attachment_image_src( $imagePost->ID, 'full' );
    $get_masonry = wp_get_attachment_image_src( $imagePost->ID, 'penci-masonry-thumb' );

    if( $type == 'single-slider' ):
    $output .= '<figure>';
    $get_masonry = wp_get_attachment_image_src( $imagePost->ID, 'penci-full-thumb' );
    endif;

    if( $type == 'masonry grid' ):
    $get_masonry = wp_get_attachment_image_src( $imagePost->ID, 'penci-thumb' );
    endif;

    /*$output .= '<a class="item-gallery-'. $type .'" href="'. $get_full[0] .'" title="'. $caption .'" data-rel="penci-gallery-image-content">';*/ /*TODO*/
    $output .= '<a class="item-gallery-'. $type .'" href="'. $get_full[0] .'" title="'. $caption .'">';

    if( $type == 'masonry' || $type == 'masonry grid' ):
    $output .= '<div class="inner-item-masonry-gallery">';
    endif;

    if( $type == 'single-slider' ){
    $output .= '<img class="owl-lazy" data-src="'. $get_masonry[0] .'" alt="'. $alt .'">'; /*TODO2*/
    /*$output .= '<img class="owl-lazy" data-src="'. $get_masonry[0] .'" alt="">';*/
    } else {
    $output .= '<img src="'. $get_masonry[0] .'" alt="'. $alt .'">'; /*TODO2*/
    /*$output .= '<img src="'. $get_masonry[0] .'" alt="">';*/
    /*$output .= wp_get_attachment_image( $imagePost->ID, 'penci-masonry-thumb' );*/
    }

    if( $type == 'masonry' || $type == 'masonry grid' ):
    $output .= '</div>';
    endif;

    $output .= '</a>';

    if( $type == 'single-slider' ):
    if( $caption ):
    $output .= '<p class="penci-single-gallery-captions">'. $caption .'</p>';
    endif;
    $output .= '</figure>';
    endif;

    }
    }

    --------------------------------------------------------------

    This fixes issue 2 (medium images instead of the correct ones -> see image 4), 

    yet I still strangely have the alt-description as caption...(issue 1 still exists...)


    Any ideas?


  •  2,700
    PenciDesign replied

    Hi,

    Please send me your admin url and admin account ( username and password  ) in a private reply. I will take it a look on this.


    Best Regards,

    PenciDesign

  • mc_kugelfang replied

    i'll have to push everything on a server first - currently only working on xampp

  •  2,700
    PenciDesign replied

    Hi,

    Ok. When you done, let's send that infor for me and I will take it a look.


    Best Regards,

    PenciDesign