Alt & Title Text for WP Tiles Images
-
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!
- The topic ‘Alt & Title Text for WP Tiles Images’ is closed to new replies.