Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Colocar Thickbox nativo do Wordpress */
- /* Este snippet vai no arquivo functions.php */
- // ADICIONANDO SCRIPTS
- add_action('init', 'meu-tema_init');
- function meu-tema_init() { if (!is_admin()) {
- wp_deregister_script('jquery');
- // Adiciona a cópia local no footer
- wp_register_script('jquery', '/wp-includes/js/jquery/jquery.js', false, '1.4.2', true);
- // des-comente se for para carregar a biblioteca do Google
- //wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, '1.4.2', true);
- wp_enqueue_script('jquery');
- //caregando o thickbox
- wp_enqueue_script('thickbox',null,array('jquery'));
- wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0', true);
- //carregando seus scripts
- wp_enqueue_script('meus-scripts', get_bloginfo('template_url') . '/js/meus-scripts.js', array('jquery'), '1', true);
- } }
- /* Para acrescentar a classe do thickbox manualmente no link da imagem:
- <a class="thickbox" href="...... */
- /* Para acrescentar a classe do thickbox de forma automática, acrescente no seu arquivo meus-scripts.js: */
- jQuery(document).ready(function() {
- jQuery(".entry-content a img").parent("a").addClass("thickbox");
- });
Advertisement
Add Comment
Please, Sign In to add comment