WordPress.org

Ready to get started?Download WordPress

Forums

WP UI - Tabs, Accordions, Sliders
Regarding custom code for Google's jQwery API (2 posts)

  1. venug
    Member
    Posted 2 years ago #

    I would like to use this code to use Google's jQwery API directly :

    //Making jQuery Google API
    function modify_jquery() {
    	if (!is_admin()) {
    		// comment out the next two lines to load the local copy of jQuery
    		wp_deregister_script('jquery');
    		wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', false, '1.4.4');
    		wp_enqueue_script('jquery');
    	}
    }
    add_action('init', 'modify_jquery');

    As the tabs on pages created with your plugin view-able by every user (Guest,editor,admin etc.) , am I need to change the ((!is_admin()) role to 'read' capability ?

    http://wordpress.org/extend/plugins/wp-ui/

  2. kavingray
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there,

    You can definitely do so, but i recommend using the recent jQuery version, >= 1.6.

    //Making jQuery Google API
    function modify_jquery() {
    	if (!is_admin()) {
    	wp_deregister_script('jquery');
    	wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js', false, '1.6.4');
    	}
    }
    add_action('init', 'modify_jquery');

    As for the tabs, the script is included on Viewer-facing end. You will have to set the capabilities manually for different posts. Assigning capabilities role to jQuery is probably not a good idea.

    On the admin end the script is only included with the plugin options page. If you want to use the tabs on other admin pages, you will have enqueue them in admin_init or admin_print_footer_scripts, accordingly.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags