WordPress.org

Ready to get started?Download WordPress

Forums

Proper way to include jquery UI to your plugin option page (5 posts)

  1. jurehotujec
    Member
    Posted 2 years ago #

    Hello,
    can please someone explain what is the proper way of including jquery UI to my plugin options page.

    Thank you in advance,
    Jure

  2. Peter Wooster
    Member
    Posted 2 years ago #

    You should use enqueue script.
    /peter

  3. jurehotujec
    Member
    Posted 2 years ago #

    Thank you for your fast reply. Is it different if i use this script for frontend or backend or do I do the samo?

    Thank you very much

  4. lerizzle
    Member
    Posted 2 years ago #

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    There's actually a section on adding script to your plugin page

  5. Peter Wooster
    Member
    Posted 2 years ago #

    That's the same link that I posted.

    You really don't want to mess with the backend admin side under most circumstances. I usually put a test for the admin to prevent interfering with that, e.g.

    if( !is_admin()){
       wp_deregister_script('jquery');
       wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"), false, '1.7.1');
       wp_enqueue_script('jquery');
    }

    This code comes from functions.php in one of my themes that needed the full version of jQuery to be installed in the front end only. Some programmers restrict the loading of javascript to specific pages, but that makes little sense as the script will get cached and it complicates matters.

Topic Closed

This topic has been closed to new replies.

About this Topic