WordPress.org

Ready to get started?Download WordPress

Forums

Use Google Libraries
[resolved] Use Google Libraries not working with other plugins (11 posts)

  1. kletskater
    Member
    Posted 2 years ago #

    Use Google Libraries is not compatible with WP Photo Album Plus and WP-SimpleViewer.

    http://wordpress.org/extend/plugins/use-google-libraries/

  2. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    You didn't exactly give me much to go on here.

    I took a quick look at WP Photo Album Plus shows that it enqueues scripts that rely on jQuery, but to not register the dependency, before it equeues jQuery. That shouldn't ever work, but maybe it does in some situations.

    The function wpaa_admin_scripts should look more like this:

    function wppa_admin_scripts() {
            wp_register_script( 'wppa_upload_script', WPPA_URL.'/wppa-multifile-compressed.js' );
            wp_register_script( 'wppa_admin_script', WPPA_URL.'/wppa-admin-scripts.js', array('jquery') );
            wp_enqueue_script( 'wppa_upload_script' );
            wp_enqueue_script( 'wppa_admin_script' );
    }

    WP-SimpleViewer calls wp_*_script methods outside of a hook, which is documented to break the script loader in WordPress.

    FYI: If you enable WP_DEBUG it should alert you to these issues, in general.

  3. kletskater
    Member
    Posted 2 years ago #

    thanks for pointing this out to me.
    I will past on the message to both plugin admins

  4. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    Also, if you are running WordPress 3.4 make sure you are also running Use Google Libraries 1.5 (needed because the jQuery UI used by WordPress 3.4 isn't on Google's servers, which 1.5 can now detect).

  5. kletskater
    Member
    Posted 2 years ago #

    i've Versie: 1.2.1 .. 1.5 can't find yet

  6. Jacob N. Breetvelt
    Member
    Posted 2 years ago #

    @Jason Penny:

    The current version of wppa+ has:

    function wppa_add_javascripts() {
    	wp_enqueue_script('jquery');
    	wp_enqueue_script('wppa', WPPA_URL.'/wppa.js', array('jquery'));
    }

    The file wppa-multifile-compressed.js need not to be enqueued, it has no deps and is only loaded when it is used.

    Is it to prefer to ommit the enqueueing of jQuery?

  7. Jason Penney
    Member
    Plugin Author

    Posted 2 years ago #

    kletskater: 1.5 has been up for download in the normal place since yesterday :

    http://wordpress.org/extend/plugins/use-google-libraries/

    opajaap: I was referring to code that was in your trunk yesterday. Did you change it since? The function name I mentioned is different. And if you registered jQuery as a dependency, you don't explicitly enqueue it unless you are injecting inline scripts that need it.

  8. Jacob N. Breetvelt
    Member
    Posted 2 years ago #

    Yes, i put the jQuery dependancy in yesterday as a result of someone who caused me hours of troubleshooting as he fooled around with remove_action('wp_head', 'wp_enqueue_scripts', 1); while i inject data into wppa.js in the header.

    Thanx for your answer, i will leave the enqueueing of jQuery out in the next version as i do not do injections that need jQuery.

  9. kletskater
    Member
    Posted 2 years ago #

    Thanks Jason and opajaap for looking in to this.

  10. Jacob N. Breetvelt
    Member
    Posted 2 years ago #

    Removed the explicit enqueue of jquery in 4.6.1 so now it should work

  11. Steven
    Member
    Posted 2 years ago #

    @Jason Penney

    WP-SimpleViewer calls wp_*_script methods outside of a hook, which is documented to break the script loader in WordPress.

    Thank you for reporting.
    This will be fixed in the next version of WP-SimpleViewer.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic