url – ajax loaded but no JS

Try this code in your complete callback of the load function: $(“.postbox_wrapper”).load( jQuery(this).attr(“href”) + ” .postbox_wrapper”, function(response, status, xhr) { // complete callback // create a empty div var div = document.createElement(‘div’); // fill div with response div.innerHTML = response; // take correct part of the response var ref = $($(div).find(‘.postbox_wrapper’).html()); // filter response for … Read more

“Conflict” with jQuery (or its plugins)?

You can use $ but it is advised you don’t. Use jQuery or something like the example in your link, if you must use $ you can do so like this; $.noConflict(); jQuery(document).ready(function($) { // $() will work as an alias for jQuery() inside of this function }); //$ will cause problems if put here:) … Read more

Can’t call Javascript function – scope?

You need to put your doSomething in the correct namespace, or at least in a namespace. The simplest way would be to put it in the window namespace: jQuery(document).ready(function($) { window.doSomething = function() { alert(“Time for a coffee break!”); }; });

Security to delete post by Admin

At first, read something about WordPress Ajax API and about Roles and Capabilities – capability to “edit_posts” has even Contributor. I would suggest to check for ‘delete_others_posts’ to prove the user is at least Editor. Or use capability of ‘manage_options’ (has Administrator, not Editor). Further, there is a check ajax referer function for you to … Read more

How to use Facebox in WordPress theme?

// UPDATE This should work (it does for me, at least): in your theme’s folder, create the subfolder facebox put only the content of the src folder into your facebox folder (i.e., closelabel.png, facebox.css, facebox.js, loading.gif). put the following in your functions.php: function my_facebox_scripts() { wp_enqueue_style( ‘facebox’, get_template_directory_uri().’/facebox/facebox.css’, array(), false, ‘screen’ ); wp_enqueue_script( ‘facebox’, get_template_directory_uri().’/facebox/facebox.js’, … Read more

jQuery accordion plugin won’t work once used in WP

You seem to still be having issues, what i’d do to avoid having all that code clutter the header is setup a bunch of enqueues, but handle the html5 js inside the print scripts action along with the appropriate conditional comments(there’s no proper way to do this with the enqueue system). First the HTML5 js, … Read more