Home › Forum › Problemi Vari con WP › WordPress e plugin jQuery
-
AutorePost
-
-
27 Ottobre 2010 alle 9:57 #15411mfarroniPartecipante
Ciao a tutti,
da poco mi sono affacciato al mondo wordpress. Ultimamente ho visto che jQuery permette di fare molte cose e cosଠho provato ad inserire dentro un template wordpress la libreria jquery_corner.js.
Come ho letto ho eseguto questi comendi:
1- dentro il file HEADER.PHP ho inserito nella parte <head> il seguente corpo php
#codice inziale con tag <html>
<script type=”text/javascript” src=”../../../wp-includes/js/jquery/jquery.js”></script>
<?php
wp_enqueue_script(“jquery”);
wp_enqueue_script(“jquery-ui-1.8.5.custom.min.js”);
wp_enqueue_script(“jquery-1.4.2.min.js”);
wp_enqueue_script(“jquery.flip.min.js”);
wp_enqueue_script(“jquery.flip.js”);
?>
<script type=”text/javascript” src=”wordpress/wp-includes/js/jquery/jquery_corner.js” ></script>
<script type=”text/javascript”>
function(){jQuery.noConflict();}
</script>
<script>
function angoli(){jQuery(“div[title = ‘test’]”).corner(“20px”);};
function effettomostra() {jQuery(“div[title = ‘F_login’]”).show(“bounce”);};
function effettonascondi(){ jQuery(“div[title = ‘F_login’]”).hide(); };
function caricato(){alert(“caricato”); };
</script>
<?php wp_head(); ?>
2- nella parte page.php ho inserito dopo il div di interesse la funzione angoli().
Il problema è che mi dice che la funzione corner(), definita nell’header.php dentro function angoli(){}, non è definita. Mentre se la uso in un file di test(file singolo), funziona.
Inoltre ho provato a caricare la libreria jquery_corner.js anche tra i tag <script type=”text/javascript”></script>
Il risultato è sempre lo stesso: la funziona corner() non viene riconosciuta.
Qualcuno può darmi una dritta
Grazie
Massimo
-
29 Ottobre 2010 alle 7:30 #78077mapoPartecipante
mi permetto di consigliarti di leggere prima http://codex.wordpress.org/Function_Reference/wp_enqueue_script e ti suggerisco di usare
function.php
-
29 Ottobre 2010 alle 8:31 #78078marko80wpPartecipante
Ciao, che cosa contiene jquery-ui-1.8.5.custom.min.js?? visto che e’ un “custom” e’ probabile che tu l’abbia scaricato e/o copiato e che contenga gia jquery + alti plugin.. tutto in un file per comodita’ diciamo per il plugin scelto(se cerchi la pagina di download di jquery vedrai che puoi fare un dload custom a blocchi selezionati da te).
A volte quini da errore se per qualche motivo viene inclusa due volte la stessa libreria e se provato a se appunto, magari funziona.
Ho visto che hai usato il no conflict e’ gia dovrebbe essere buono, puoi assegnarli un nome alla viariabile per non avere conflitti con altri script.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.