Howto use WP built in Thickbox for images?

What if you try adding this to your functions.php function tb(){ wp_enqueue_script(‘thickbox’,null,array(‘jquery’)); wp_enqueue_style(‘thickbox.css’, “https://wordpress.stackexchange.com/”.WPINC.’/js/thickbox/thickbox.css’, null, ‘1.0’); } add_action(‘wp_enqueue_scripts’,’tb’); and keeping your bit of jQuery (not sure what your are needing those php variables for): jQuery(document).ready(function() { jQuery(“img”).parent(“a”).addClass(“thickbox”); });

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

Extracting Address from Custom Post via Javascript for Google Maps API

Well, this is kind of easy.. The google-map API needs a format like Your Street 123, 54321 Your City Assuming you have your data like this: <div id=”street”>Your Street 123</div> <div id=”zip”>54321</div> <div id=”city”>Your City</div> Assuming you are using jQuery: (function($){ $.fn.create_gmap_address = function() { var street = $(‘#street’).html(); var zip = $(‘#zip’).html(); var city … 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

Problem passing id-specific objects to javascript via wp_localize_script

In your code playerId is a string. So playerId.tracks can’t work. So you can create a multidimensional array with wp_localize_script (WP 3.3+): $playlists = array( ‘playlist150’ => array( ‘tracks’=> array(‘track1’, ‘track2’) ), ‘playlist257’ => array( ‘tracks’=> array(‘track3’, ‘track4’) ) ); wp_localize_script( ‘some_handle’, ‘allPlaylists’, $playlists ); Then in the js use the bracket notation to retrieve … Read more

Seperate functions.php for part of site

functions.php unfortunately is very ingrained part of theme load process. If your architecture is flexible enough you should be able to conditionally unhook related bits. Even if it’s not — templates give you complete control over page output. You could go as far as completely omitting wp_head()/wp_footer() calls and handle assets (semi-)manually if that is … Read more