• Hello all! This problem wracked my brain for the longest time. This is a (sort of) fix because I’m not a professional developer by any means. I’m hoping the plugin author will see this eventually and include it in an update to WP Tiles, but hopefully this will help some of you fine folks with loading your SEO necessary title & alt data for your images.

    What I did was just call the title data for both. This requires you edit the plugin file itself (WP-Tiles/src/WPTiles.php) and edit line 429 to this:

    <img src='<?php echo $img ?>' class='wp-tiles-img' itemprop="image" alt='<?php echo esc_attr( apply_filters( 'the_title', $post->post_title, $post->ID ) ) ?>' title='<?php echo esc_attr( apply_filters( 'the_title', $post->post_title, $post->ID ) ) ?>' />

    You will see it reflected in your HTML that your title of your images are now in there.

    If anyone else who is better at PHP can help me load the alt data properly, awesome. If not, I’ll just leave it as it is, but hopefully this helps some people looking for the same answer to add alt or title data to WP Tiles images!

    • This topic was modified 7 years, 3 months ago by the9mm.
Viewing 1 replies (of 1 total)
  • Hi! Thanks for your post, it helped me find the right place to insert my code (to retrieve the alt text) into the wp-tiles plugin. So here it is, just add this before your code..

    $thumbnail_id = get_post_thumbnail_id( $post->ID ); $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);

    and then you can go

    alt='<?php echo $alt ?>'

    Have a great day ??

Viewing 1 replies (of 1 total)
  • The topic ‘Alt & Title Text for WP Tiles Images’ is closed to new replies.