WordPress.org

Support

Support » Plugins and Hacks » FitVids for WordPress » [Resolved] [Plugin: FitVids for WordPress] Object doesn't support property or method 'fitVids'

[Resolved] [Plugin: FitVids for WordPress] Object doesn't support property or method 'fitVids'

  • i noticed this javascript error when i tried to set a custom CSS selector on the fitvids options page.

    The following prints in the footer:

    jQuery(document).ready(function() {
        		jQuery('.external-videos').fitVids();
        	});

    which would be right except that it prints before the fitvids.js is loaded.

    // add fitvids
        	wp_register_script( 'fitvids', plugins_url('/jquery.fitvids.js', __FILE__), array('jquery'), '1.0', true);
        	wp_enqueue_script( 'fitvids');
        	add_action('wp_footer', array($this, 'add_fitthem'));

    JS files that are enqueued in the footer (that last parameter = true) are actually added to wp_footer via the wp_print_footer_scripts hook which has a priority of 20.

    since you aren’t declaring a priority on

    add_action('wp_footer', array($this, 'add_fitthem'));

    it is 10 by default which comes before the script is loaded, hence my error.

    this can be corrected in 1 of 2 ways. by changing to either

    add_action('wp_print_footer_scripts', array($this, 'add_fitthem'));

    or

    add_action('wp_footer', array($this, 'add_fitthem'), 30);

    http://wordpress.org/extend/plugins/fitvids-for-wordpress/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: FitVids for WordPress] Object doesn't support property or method 'fitVids'’ is closed to new replies.
Skip to toolbar