Title: HTML validation error with Post Thumbnail
Last modified: January 31, 2018

---

# HTML validation error with Post Thumbnail

 *  Resolved [Bjarne Oldrup](https://wordpress.org/support/users/oldrup/)
 * (@oldrup)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/html-validation-error-with-post-thumbnail/)
 * Hi!
 * Thanks for a great plugin 🙂
 * I’m experiencing what appears to be a tiny bug.
 * I’m adding the Related Posts by Taxonomy widget to the sidebar. And as long a
   I stick to plain post links format, the HTML validates just fine.. However, if
   I choose Post Thumbnails instead, the following error is thrown:
 * “Element style not allowed as child of element div in this context.”
 * Please see the (unlisted) screencast
 * [https://youtu.be/yfZxguAY0QE](https://youtu.be/yfZxguAY0QE)
 * It appears to be caused by the inline styling.. Any way to place that somewhere
   else, in an external file or disable it entirely?
 * Kind regards
    Bjarne

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Bjarne Oldrup](https://wordpress.org/support/users/oldrup/)
 * (@oldrup)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/html-validation-error-with-post-thumbnail/#post-9921033)
 * Update: Disabling the inline styling via the filter described at [https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/filters/#use_default_gallery_style](https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/filters/#use_default_gallery_style)
   fixes the issue, no more HTML validation errors.
 * Could I politely make a small feature request? Either make the inline styling
   optional in the widget and/or shortcode or consider disabling it by default?
 * Best regards
    Bjarne
 *  Plugin Author [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/html-validation-error-with-post-thumbnail/#post-9921902)
 * Hi Bjarne
 * Thanks for your input.
 * The related posts gallery markup is identical to the WordPress gallery and uses
   the styles from your theme for the layout. Newer theme’s will probably make use
   of html5 theme support. This disables the inline styling by default.
    [https://developer.wordpress.org/reference/functions/add_theme_support/#html5](https://developer.wordpress.org/reference/functions/add_theme_support/#html5)
 * Only (older) theme’s that don’t support it get the inline styling. This was done(
   by WordPress) for backward compatibility. For that reason I’m going to follow
   the markup WordPress produces, so most users get what’s expected by their theme.
 * The only other way you can disable it, besides the filter, is to ask your theme
   developer to add html5 support for the gallery.
 *  Thread Starter [Bjarne Oldrup](https://wordpress.org/support/users/oldrup/)
 * (@oldrup)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/html-validation-error-with-post-thumbnail/#post-9922389)
 * Thanks for the quick reply and the clarification 🙂
 * It looks like the styling is added in /includes/functions-thumbnail.php line 
   122 and 20 lines forward. As far as I understand, the reason behind adding the
   inline styling is to mimic legacy wordpress behaviour? I understand that its 
   simpler for the user, but hardcoding #rpbt-related-gallery-{$instance} selectors
   for borders etc, actually makes it a bit hard to overrule without !important –
   at least that was my experience.
 * I’m using Divi from Elegant Themes. Its quite widespread and regularly updated.
   But I can’t say it announces any hmtl5 support that could disable inline styling..
   Hm…
 * The filter does fix it for me, that’s definitely a valid workaround. Still, consider
   a “Apply Inline Styling” checkbox in the widget a feature request then 🙂
 * Again – thank’s for a very nice plugin. Of the handful I’ve tested, it’s definitely
   the best.
 * Kind regards
    Bjarne

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘HTML validation error with Post Thumbnail’ is closed to new replies.

 * ![](https://ps.w.org/related-posts-by-taxonomy/assets/icon.svg?rev=1115231)
 * [Related Posts by Taxonomy](https://wordpress.org/plugins/related-posts-by-taxonomy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/related-posts-by-taxonomy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/related-posts-by-taxonomy/)
 * [Active Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/related-posts-by-taxonomy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/related-posts-by-taxonomy/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Bjarne Oldrup](https://wordpress.org/support/users/oldrup/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/html-validation-error-with-post-thumbnail/#post-9922389)
 * Status: resolved