Meta Slider
W3 validation error: update / workaround? (6 posts)

  1. ElectricFeet
    Posted 2 years ago #

    Just realised that I hadn't reviewed Meta Slider. Now remedied :-)

    I have the w3c validation error "Element link is missing required attribute property" mentioned previously on this forum here and here. In those posts you said that you had implemented a plugin (now sadly not available to view on github) to avoid the error and were considering integrating it in Meta Slider. Did this go any further?

    Given that I'm loading Meta Slider in php, could I link the stylesheet myself in the header, to avoid the error? If so, how would I stop it trying to load twice (or will the browser take care of this)?

    I should also add that I don't really care about the error, but I would like to improve the rendering of the slider. There's a bit of jumpiness on the page as the page rearranges itself when the slider image appears (site link: darioalfonsi.com).


  2. mobilewebexpert
    Posted 2 years ago #

    I was having this same problem. If you install and activate the 'W3 Total Cache' plugin then go to 'Performance' > 'General Settings' and tick the box to enable 'Minify', then Save - that should fix the validation error. :)

  3. ElectricFeet
    Posted 2 years ago #

    Thanks, mobilewebexpert. Yes, I saw that as an option. For now I prefer not to use a cache. My server is good and fast. I've installed caches in the past and have had too many problems (W3TC completely trashed my site, as I didn't understand the intricacies of uninstalling at the time--not nice behaviour for a then-newbie to deal with).

    I'm hoping to be able to hook on the header myself instead.

  4. Matcha Labs
    Plugin Author

    Posted 2 years ago #

    Hi ElectricFeet,

    You can indeed manually copy the Meta Slider includes from the footer of your page, and paste them into the header.php file in your theme. After doing that, just disable the Print CSS and Print JS options in the advanced slideshow settings.

    Unfortunately it's not possible to enqueue CSS directly into the <head> of the page from a shortcode, if it was possible I would change it right now!


  5. ElectricFeet
    Posted 2 years ago #

    Thanks Tom. Once I get my head around what that means I'll apply it :-)

  6. ElectricFeet
    Posted 2 years ago #

    OK, I think I'm beginning to understand what you said there (I'm not a developer).

    As I understand it, MetaSlider cannot load its CSS/js at the very first possible moment, because the shortcode is in the page's html, which is loaded way afterwards.

    So MetaSlider loads it in the WP footer, which is the next point at which it can.

    If I load it, however, I can do so much earlier, because I know (even now) exactly when I want to load that CSS/js—unlike MetaSlider, which can never know until it hits the shortcode.

    So I've written the following, which will load the CSS/js by hooking onto wp_head(). It's to be added to my child theme's functions.php.

    add_action('wp_head', 'enqueue_metaslider_script_and_styles');
    function enqueue_metaslider_script_and_styles(){
    	if ( is_front_page() ) {
    		wp_enqueue_script( 'my-metaslider-flex-slider', plugins_url() . '/ml-slider/assets/sliders/flexslider/jquery.flexslider-min.js' , array( 'jquery' ), '3.0.1' );
    		wp_enqueue_style( 'my-metaslider-flex-slider', plugins_url() . '/ml-slider/assets/sliders/flexslider/flexslider.css', false, '3.0.1' );
    		wp_enqueue_style( 'my-metaslider-public', plugins_url() . '/ml-slider/assets/metaslider/public.css', false, '3.0.1' );

    It seems to work well on my local install. After I unchecked Print CSS and Print JS on the front-page slider, it loads the CSS and JS only once.

    Any chance you can tell me if I'm doing something stupid before I add it to my live sites?

    Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Meta Slider
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic