rozanchetta

Wordpress - Thickbox no Wordpress

Aug 15th, 2011
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. /* Colocar Thickbox nativo do Wordpress */
  2.  
  3. /* Este snippet vai no arquivo functions.php */
  4.  
  5. // ADICIONANDO SCRIPTS
  6. add_action('init', 'meu-tema_init');
  7. function meu-tema_init() { if (!is_admin()) {
  8. wp_deregister_script('jquery');
  9. // Adiciona a cópia local no footer
  10. wp_register_script('jquery', '/wp-includes/js/jquery/jquery.js', false, '1.4.2', true);
  11. // des-comente se for para carregar a biblioteca do Google
  12. //wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, '1.4.2', true);
  13. wp_enqueue_script('jquery');
  14. //caregando o thickbox
  15. wp_enqueue_script('thickbox',null,array('jquery'));
  16. wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0', true);
  17. //carregando seus scripts
  18. wp_enqueue_script('meus-scripts', get_bloginfo('template_url') . '/js/meus-scripts.js', array('jquery'), '1', true);
  19. } }
  20.  
  21. /* Para acrescentar a classe do thickbox manualmente no link da imagem:
  22. <a class="thickbox" href="...... */
  23.  
  24. /* Para acrescentar a classe do thickbox de forma automática, acrescente no seu arquivo meus-scripts.js: */
  25.  
  26.  jQuery(document).ready(function() {
  27.      jQuery(".entry-content a img").parent("a").addClass("thickbox");
  28.  });
Advertisement
Add Comment
Please, Sign In to add comment