WordPress.org

Ready to get started?Download WordPress

Forums

Meta Slider
[resolved] Meta Slider v. 2.3.1 xhtml validation error (6 posts)

  1. mgorzka@curtislibrary.com
    Member
    Posted 10 months ago #

    Hello all,

    When I try to validate the page that Meta Slider is installed on (XHTML transitional), I get this validation error:

    Line 113, Column 27: document type does not allow element "style" here

    <style type="text/css">

    Here's how it appears within the markup on that page:

    <!-- meta slider -->
    <div style="max-width: 850px;" class="metaslider metaslider-flex metaslider-24304 ml-slider">
    <style type="text/css">
    @import url('http://www.curtislibrary.com/wp-content/plugins/ml-slider/assets/metaslider/public.css?ver=2.3.1');
    @import url('http://www.curtislibrary.com/wp-content/plugins/ml-slider/assets/sliders/flexslider/flexslider.css?ver=2.3.1');
    </style>
    <div id="metaslider_container_24304">
    <div id="metaslider_24304" class="flexslider">
    <ul class="slides">
    <li style="display: none;"><a href="http://www.curtislibrary.com/25186-2/"><img src="http://www.curtislibrary.com/wp-content/uploads/2013/08/other-creator-rotating-gallery-bill1.jpg" height="360" width="850" alt="Bill Burke" class="slider-24304 slide-24762" /></a>
    <li style="display: none;"><a href="http://www.curtislibrary.com/24862-2/"><img src="http://www.curtislibrary.com/wp-content/uploads/2013/08/other-creator-rotating-gallery-maria1.jpg" height="360" width="850" alt="Maria Castellano-Usery" class="slider-24304 slide-24763" /></a>
    
    </div>
    </div>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Mike

    http://wordpress.org/plugins/ml-slider/

  2. Matcha Labs
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Mike,

    XHTML is quite an old specification (2001) and is pretty strict, Meta Slider won't (and probably won't ever) output valid XHTML. The tradeoff of putting the style tags into the header of every page (not just the ones meta slider is on) is too great to achieve compatibility with an old standard.

    But, HTML5 (2012) is more standard nowadays. You can achieve HTML5 compatibility by adding this to your themes functions.php file:

    function ms_scoped() {
        return ' scoped';
    }
    add_filter('metaslider_style_attributes', 'ms_scoped', 25, 3);

    Regards,
    Tom.

  3. mgorzka@curtislibrary.com
    Member
    Posted 10 months ago #

    I'll; do that - Thanks, Tom!

  4. orbitbob
    Member
    Posted 10 months ago #

    I have the same issue and when I put the above code in my functions.php file it broke the entire slider.

  5. esmi
    Forum Moderator
    Posted 10 months ago #

    As per the Forum Welcome, please post your own topic.

  6. Matcha Labs
    Member
    Plugin Author

    Posted 4 months ago #

    Just posting this for anyone who has found this thread on Google.

    I've been working on a plugin to move the Meta Slider link, inline script and style blocks into the <head> of the page:

    https://github.com/tomhemsley/ml-slider-html5

    To install, click 'Download ZIP', then go to Plugins > Add New > Upload and select the .zip file. So far there isn't a settings page or anything like that.

    If you're using this plugin, please let me know how it goes! I may integrate the functionality into the Meta Slider plugin if it's working well

    Regards,
    Tom

Reply

You must log in to post.

About this Plugin

About this Topic