Created
July 22, 2013 06:07
-
-
Save WenLiangTseng/6051617 to your computer and use it in GitHub Desktop.
使用WP內建的ThickBox
This file contains hidden or 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
//加入 functions.php | |
function add_themescript(){ | |
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('init','add_themescript'); | |
//加在 footer.php,放在 wp_footer() 之前 | |
<script type="text/javascript"> | |
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> | |
//and how to use thickbox you can see the | |
<a href="http://jquery.com/demo/thickbox/"> thickbox page</a> in jquery site . | |
//Example: To show feedbernuer subscription link in popup windows | |
<a href="http://feedburner.google.com/fb/a/mailverify?uri=manchumahara&loc=en_US&KeepThis=true&height=450&width=600&TB_iframe=true" class="thickbox">Subscribe to my blog via Email</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment