Created
June 16, 2012 13:55
-
-
Save remkus/2941390 to your computer and use it in GitHub Desktop.
Add WordPress' thickbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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