- This topic has 10 replies, 3 voices, and was last updated 2 years, 2 months ago by
David.
-
AuthorPosts
-
March 11, 2020 at 3:09 am #1191630
ustar
Hi, there!
I noticed that Alt texts and Titles for image gallery is not showing in the code of page.
For example, i see only alt text and title in preview images when i browse on mobile screen.
When i see page on desktop, no alt text in code.
But, i checked all images for this product and all images witn metadata.Could you please help me to fix this?
Thanks in advance.Regards, Sergey.
March 11, 2020 at 5:28 am #1191724David
StaffCustomer SupportHi there,
it looks like you used Niche from the GP Site library to create the Gallery Stack.
If so you would need to update the Appearance > Elements …. the Hook Element named Gallery Stacklet us know if thats the case.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 12, 2020 at 2:19 pm #1193275ustar
Hi, David!
Shold i just push button “Update” or i need to replace the code?
If i need use the new code, where i can find it?Regards, Sergey.
March 12, 2020 at 4:12 pm #1193321David
StaffCustomer SupportIts going to require some new code – Title attribute is fairly simple but the getting the Alt is proving to be a pain. Can you paste the code you have in your current Gallery Stack Hook here so i can take a look at the changes it will require.
When adding code to the forum can you highlight the code and click the Code Button before submitting.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 13, 2020 at 12:33 am #1193494ustar
Hi, David!
The code is original. I have changed nothing.
<div class="woo-sumamry-wrap"><!-- open wrap --> <div class="woo-gallery-stack hide-on-mobile"> <?php global $product; if ( has_post_thumbnail( $product->get_id() ) ) { $attachment_ids[0] = get_post_thumbnail_id( $product->get_id() ); $attachment = wp_get_attachment_image_src( $attachment_ids[0], 'full' ); ?> <img src="<?php echo $attachment[0] ; ?>"/> <?php } if ( method_exists( $product, 'get_gallery_image_ids' ) ) { $product_image_ids = $product->get_gallery_image_ids(); foreach( $product_image_ids as $product_image_id ) { $image_url = wp_get_attachment_url( $product_image_id, 'full' ); echo '<img src="' . $image_url . '">'; } } // Closing div found in Close Summary Wrap element ?> </div>
March 13, 2020 at 1:19 am #1193510Marcel
Following this thread also…
March 13, 2020 at 4:11 am #1193615David
StaffCustomer SupportTry this instead:
<div class="woo-sumamry-wrap"><!-- open wrap --> <div class="woo-gallery-stack hide-on-mobile"> <?php global $product; // Get post product thumbnail if ( has_post_thumbnail( $product->get_id() ) ) { $attachment_ids[0] = get_post_thumbnail_id( $product->get_id() ); $attachment = wp_get_attachment_image_src( $attachment_ids[0], 'full' ); $attachment_alt = get_post_meta( $attachment_ids[0], '_wp_attachment_image_alt', TRUE); $attachmnent_title = get_the_title( $attachment_ids[0] ); ?> <img src="<?php echo $attachment[0] ; ?>" alt="<?php echo $attachment_alt; ?>" title="<?php echo $attachmnent_title; ?>" /> <?php } // Get Product Gallery Images if ( method_exists( $product, 'get_gallery_image_ids' ) ) { $product_image_ids = $product->get_gallery_image_ids(); foreach( $product_image_ids as $product_image_id ) { $image_url = wp_get_attachment_url( $product_image_id, 'full' ); $image_alt = get_post_meta( $product_image_id, '_wp_attachment_image_alt', TRUE); $image_title = get_the_title( $product_image_id ); echo '<img src="' . $image_url . '" alt="' . $image_alt . '" title="' . $image_title . '">'; } } // Closing div found in Close Summary Wrap element ?> </div>
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 14, 2020 at 1:12 am #1194390ustar
Hi, David!
Alt texts on the code now! Thank you very much!
Regards, Sergey.
March 14, 2020 at 1:12 am #1194391ustar
)
March 14, 2020 at 2:01 am #1194411March 14, 2020 at 4:51 am #1194524David
StaffCustomer SupportAwesome – ill update Niche when i get a moment.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.