• 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

    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

    (@oldrup)

    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

    Plugin Author keesiemeijer

    (@keesiemeijer)

    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.

    Thread Starter Bjarne Oldrup

    (@oldrup)

    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.