Update: Disabling the inline styling via the filter described at 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
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
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.
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