• Resolved Guido

    (@guido07111975)


    Hi!

    I am trying to add a jquery dialog inside a widget.

    I use the jquery example listed above, the only difference is how I include the scripts.

    I enqueue the required js and css scripts in my plugin functions file:

    
    function my_custom_script() { 
    	wp_enqueue_script( 'my_script', plugins_url( '/js/my-file.js' , __FILE__ ), array('jquery', 'jquery-ui-core', 'jquery-ui-dialog') ); 
    	wp_enqueue_style('my_css', plugins_url('/css/jquery-ui.css',__FILE__));
    } 
    add_action( 'admin_enqueue_scripts', 'my_custom_script' ); 
    

    I know all required scripts and my-file.js are loaded on widget page. But no effect when I click the button.

    Is jquery blocked inside the Widgets Api perhaps?

    Guido

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator bcworkz

    (@bcworkz)

    Hey Guido,

    Try using the “wp_enqueue_scripts” action hook. You want the jQuery for the front end, not back end ??

    Thread Starter Guido

    (@guido07111975)

    Hi BC,

    No, It’s for backend. When user adds a widget it contains a button (among other things) and if user clicks that button, the dialog appears.

    Guido

    Moderator bcworkz

    (@bcworkz)

    Oops! I just assumed so because I save the fancy UI stuff for the front end. Doing so in the back end as well is admirable. That’s why you’re a theme dev and I’m not! ??

    It’s not so much that it’s blocked, it’s that the widget page is heavily scripted already. I got as far as determining the on click event fires, but instead of opening the dialog, the widget minimizes. There’s some sort of conflict with the default widget page scripts. There ought to be some solution, but I’m not sure what it is.

    I just used the example’s .dialog() method as a test. Maybe if your script altered visibility of elements inside the widget form it’ll all work better?

    Thread Starter Guido

    (@guido07111975)

    Hi BC,

    It does popup fine on other pages inside the dashboard, only the widget page is giving me real headaches. So yes, I guess it must be a conflict with another widget script.

    As you know I’m not able to solve another thing regarding data inside the Widget Api, but for me both issues are just minor ones, so I’m closing both topics. I give up ??

    Guido

    Thread Starter Guido

    (@guido07111975)

    Hi @bcworkz

    Do you know “your” Hacks forum is removed from parent forum page? (check link)

    Guido

    Moderator bcworkz

    (@bcworkz)

    ?? “My hacks” — a little too close to the truth to be really funny!

    Yes, I did notice. There’s discussion about how to handle it. Currently it appears the advanced/developing forum will be reopened and any Hacks directed traffic will go there. As it is, the Hacks forum still exists, but no one can find it! It may be a while before anything different is implemented. Some parts of the WP organization move faster than other parts.

    In the mean time the only place that makes sense for hacking newcomers is how-to/fixing. Thanks for the heads up. Even though it’s not news to me, I appreciate you thinking of me, it means a lot!

    BC

    Thread Starter Guido

    (@guido07111975)

    The big question is: where are you going? Or is this a moment to reconsider your future presence on this forum?

    Even the Dutch forum has multiple developer related sub forums: CSS, Plugins, Coding.. This could be better, but just 1 is too general imo.

    Guido

    Moderator bcworkz

    (@bcworkz)

    It’s too bad I don’t speak Dutch! Sounds like there could have been a place for me ??

    I’m unsure what the future will bring. Right now Hacks still works even though it’s hidden, so I’ll keep watch there for a while still. I’ll likely move over to watching Developing WP if it ever gets reopened. I’ve started checking the No Replies list for coding related posts, which generally are in Fixing WP, but if someone else replies before I see it, I’ll likely never see it because there’s just too many posts in Fixing WP to read all of them.

    That’s what I enjoyed about Hacks, the volume was low enough that it was easy to read every topic. Fixing WP is a firehose of posts! I’m still committed to helping out in these forums, I’m just unsure exactly in what form that help will become. I’m not planning on going anywhere.

    In the mean time, if both Hacks and Developing WP are unusable, if you ask some sort of unusual coding question in any of the forums, I’ll likely see it just because no one else will answer, so it’ll remain on the No Replies list long enough for me to catch it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Using a jquery dialog inside a widget’ is closed to new replies.