WordPress.org

Ready to get started?Download WordPress

Forums

FitVids for WordPress
[resolved] Object doesn't support property or method 'fitVids' (3 posts)

  1. helgatheviking
    Member
    Posted 1 year ago #

    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/

  2. Kevin Dees
    Member
    Plugin Author

    Posted 1 year ago #

    I think have fixed this issue in the latest version 2.1

  3. helgatheviking
    Member
    Posted 1 year ago #

    great! thanks for your work!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic