How to use jqueryUI with Wordpress admin panel

Discussion in 'WordPress' started by pras0784, Mar 22, 2013.

  1. #1
    Hi Guys, I am trying to use jqueryUI with Wordpress admin panel. I have added jqueryUI custom css/js files in plugins folder and calling them inside my plugin index file but no effect. Can anybody help me with steps please as I am newbie? thx Pras
     
    pras0784, Mar 22, 2013 IP
  2. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #2
    To run a Jquery script and avoid the conflict with wordpress you have to use this function : WP_ENQUEUE_SCRIPT()

    function my_init() {
       if (!is_admin()) {
           wp_enqueue_script('jquery');
       }
    }
    add_action('init', 'my_init');
    
    Code (markup):
    Replace my_init with another word according to your script...

    Here is a good wordpress codex to learn more about how to use jquery in wordpress :


    wp_enqueue_script()
    add_action()
    is_admin()


    Goodluck
     
    themes4all, Mar 22, 2013 IP
  3. pras0784

    pras0784 Greenhorn

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Yes. I got this. In which directory I need to place jquery custom js and css files? And how I need to call them in my plugin index file?
     
    pras0784, Mar 22, 2013 IP
  4. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #4
    Ok, my question is that you are building your own Plugin or you just need to use a Jquery plugin on your wordpress website !?
     
    themes4all, Mar 22, 2013 IP
  5. pras0784

    pras0784 Greenhorn

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Well, I am developing my own plugin in Wordpress. I want to use some jquery UI features there to look better but I am not sure what files I need to call and how.

    I would really appreciate if you can share some steps to do so.
     
    pras0784, Mar 22, 2013 IP
  6. themes4all

    themes4all Well-Known Member

    Messages:
    662
    Likes Received:
    47
    Best Answers:
    6
    Trophy Points:
    100
    #6
    ok there is 2 things :

    1- the jquery library included with wordPress loads in "no conflict" mode. This is done to prevent compatibility problems with other javascript libraries. In "no-confict" mode, the $ shortcut is not available and the longer jquery is used, Example :

    jQuery(document).ready(function ($) {
    Code (markup):
    So by including the $ in parenthesis after the function call you can then use this shortcut within the code block.. so you have to pay attention to that!

    2- To get all to work for your plugin please check this Article : Link

    Hope that will help !
     
    themes4all, Mar 22, 2013 IP
  7. pras0784

    pras0784 Greenhorn

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    No luck :(
     
    pras0784, Mar 22, 2013 IP