Skip to content

Instantly share code, notes, and snippets.

@remkus
Created June 16, 2012 13:55
Show Gist options
  • Save remkus/2941390 to your computer and use it in GitHub Desktop.
Save remkus/2941390 to your computer and use it in GitHub Desktop.
Add WordPress' thickbox
<?php
add_action( 'init','fsm_thickbox' );
/**
* fsm_thickbox function.
*
* @access public
* @param mixed $text
* @return void
*/
function fsm_thickbox(){
if( !is_admin() ){
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'thickbox',null,array( 'jquery' ) );
wp_enqueue_style( 'thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0' );
}
}
add_action( 'wp_footer', 'fsm_thickbox_footer_js' );
/**
* fsm_thickbox_footer_js function.
*
* @access public
* @param mixed $text
* @return void
*/
function fsm_thickbox_footer_js() {
?>
<script>
if ( typeof tb_pathToImage != 'string' ) {
var tb_pathToImage = "<?php echo get_bloginfo( 'url' ).'/wp-includes/js/thickbox'; ?>/loadingAnimation.gif";
}
if ( typeof tb_closeImage != 'string' ) {
var tb_closeImage = "<?php echo get_bloginfo( 'url' ).'/wp-includes/js/thickbox'; ?>/tb-close.png";
}
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment