Home › Forum › Problemi Vari con WP › Mettere Audio Player appena accedi al sito
-
AutorePost
-
-
16 Gennaio 2012 alle 17:48 #20362Albert EinsteinPartecipante
Ciao ragazzi, ho visto che ci sono numerosi plug-in che funzionano come audio player da poter implementare in qualsiasi post o pagina, però non ho trovato niente che mi permettesse di inserire un piccolo audio player in alto a destra o a sinistra della mia pagina iniziale, proprio quando accedo al mio sito internet.
Sapreste indicarmi un plug-in o un modo per fare cio?
Grazie mille, ciao.
-
16 Gennaio 2012 alle 20:43 #91890
-
16 Gennaio 2012 alle 23:45 #91892Albert EinsteinPartecipante
Grazie mille, la risposta ce l’avevo sotto il naso e non l’ho vista, però ho provato e non ci sono riuscito.
Adesso ti spiego cos’ho fatto! Ho creato una cartella di nome audio con dentro un file mp3. es: http://www.domain.com/audio/song.mp3
Se applico la stringa in [audio :dido.mp3] in una pagina, tutto bene mi visualizza il lettore.
Ora applico il codice che mi hai segnalato tu, per voler mettere il mio lettore nella pagina iniziale.
Quindi vado nel file INDEX del mio tema e aggiungo:
<? Php se (function_exists ( “insert_audio_player” )) {
insert_audio_player ( “[audio: http://www.domain.com/audio/song.mp3%5D” );
}?>
però non mi visualizza niente nel sito.
Allora provo a prendere insert_audio_player e metterlo come css, ovvero:
insert_audio_player
{ float: center;
color: white; }
Ma niente da fare non lo vedo.
Mi sai dare una mano?! Grazie mille !
-
17 Gennaio 2012 alle 6:57 #91894TittiModeratore
Hai aggiunto davvero “Php se” ?
-
17 Gennaio 2012 alle 10:01 #91897zhenyaPartecipante
Utilizzando il traduttore di google per leggere la pagina in italiano, vien tradotto anche il codice.. ed “if” diventa “se”
-
17 Gennaio 2012 alle 18:57 #91920Albert EinsteinPartecipante
Caspita avete pienamente ragione! a volte scivolo sulle bucce di banana!
Comunque ho messo l’if al posto di se, ma niente da fare, il player non lo vedo e non lo sento?
Avete qualche idea? Grazie mille ciao.
-
17 Gennaio 2012 alle 19:23 #91922TittiModeratore
Sono le indicazioni dell’autore, è cosଠe non c’è nulla da aggiungere a livello di codice.
Sbaglierai altro, ad es. con che software editi il codice e/o dove lo posizioni e, visto i precedenti, assicurati di aver messo il vero percorso, non “domain.com”.
-
17 Gennaio 2012 alle 20:03 #91923Albert EinsteinPartecipante
Io lo posiziono in index del template, o bisogna posizionarlo altrove?
-
17 Gennaio 2012 alle 20:55 #91924Albert EinsteinPartecipante
Ecco il link , spero per voi che cosଠsia più chiaro:
http://www.maurosilvestrone.com/
<? Php if (function_exists ( “insert_audio_player” )) {
insert_audio_player ( “[audio: http://www.maurosilvestrone.com/audio/dido.mp3” );
}?>
Questa è la stringa che ho inserito in index:
<?php wp_get_header(); ?>
<div id=”content”>
<?php if (have_posts()) : ?>
<? Php se (function_exists ( “insert_audio_player” )) {
insert_audio_player ( “[audio: http://www.maurosilvestrone.com/audio/dido.mp3” );
}?>
<?php while (have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2 class=”title”>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
<div class=”entry”>
<?php the_content(‘Read the rest of this entry »’); ?>
</div>
<p class=”meta”>
<span class=”posted”>Posted by <?php the_author_posts_link() ?> on <?php the_time(‘F jS, Y’) ?></span>
<?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’, ‘comments’); ?>
</p>
</div>
<?php endwhile; ?>
<div class=”navigation”>
<div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
<div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>
</div>
<?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php include (TEMPLATEPATH . “/searchform.php”); ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php wp_get_footer(); ?>
-
17 Gennaio 2012 alle 21:20 #91925TittiModeratore
Continuo a vedere quel “se” e inoltre manca la chiusura di una parentesi quadra.
Costa molto copiare il codice in quella pagina linkata, aprire un semplice blocco note e incollarcelo sopra, sostituire il percorso, ricopiare il tutto e incollarlo nel file del template con un editor tipo Notepad++?
-
17 Gennaio 2012 alle 21:39 #91927Albert EinsteinPartecipante
Il codice l’ho copiato esatto! ho sbagliato adesso a scrivere qua nel forum, ma ti garantisco che il codice che ho scrito è esatto!
Quindi se tu mi confermi che cosଠva bene, ci sarà un altro motivo per il quale non riesco a visualizzarlo sul sito.
Devo programmare anche il file css?
-
18 Gennaio 2012 alle 8:56 #91933TittiModeratore
Se inserisci il codice esattamente cosà¬:
<?php if ( have_posts() ) : ?>
<?php if (function_exists(“insert_audio_player”)) {
insert_audio_player(“[audio:http://www.maurosilvestrone.com/audio/dido.mp3%5D”);
} ?>
cioè subito dopo l’inizio del loop, dovrebbe vedersi il player nel content prima del primo post.
Il CSS non c’entra, è solo per la formattazione (i colori, la grandezza, ecc.), quindi in ogni caso togli quella cosa che hai scritto su, se l’hai inserita, perché non va bene cosଠ(devi usare il nome della classe, non quello della funzione).
Se come dici il plugin funziona di per sè, cioè lo vedi nei post e nelle pagine (quindi le chiamate header/footer le hai sicuramente), e hai sicuramente il flash player, allora, per quello che ne posso sapere io da qua, l’unica causa possibile è quella che dicevo.
Edit: guardando il sorgente del tuo sito non c’è nessuna traccia dell’oggetto, cioè il player… oltre alla presenza del plugin (e quella si vede) ci dovrebbe essere una cosa tipo <p class=… ecc., e in fondo il javascript, che non c’è
-
18 Gennaio 2012 alle 22:54 #91978Albert EinsteinPartecipante
Ecco finalmente ci sono riuscito! Imbestialito dal perchè non funzionasse, ho disinstallato wordpress e reistallato tutto!
Forse il problema è stato un conflitto con temi vari, ora però è risolto e il player lo vedo e parte appena accedo al sito.
Ora però volevo posizionarlo in alto a destra, come faccio?
quale file devo modificare?
Ho provato a posizionare il codice fornito dall’autore nel css, ma non subisce variazioni.
p.audioplayer_container {
text-align: center;
}
Grazie mille titti per la pazienza. a presto.
-
18 Gennaio 2012 alle 23:09 #91979Albert EinsteinPartecipante
Ho capito solo ora qual’è stato l’inghippo! Praticamente il codice di audio player ti mette in automatico il player nella pagina di home del tema, quella pagina che il tema ha già di suo.
Io avendo messo una pagina di home statica non visualizzavo il player.
Quindi la mia domanda sporge spontanea, ma è possibile quindi rendere autonomo l’audio player e metterlo in alto a destra o a sinistra della pagina?
-
19 Gennaio 2012 alle 11:40 #91993TittiModeratore
Rendere autonomo non so che significhi. Puoi spostare il codice dove vuoi, se lo vuoi nell’header mettilo nell’header.php. E per i CSS studia un po’, qui non è sede ci sono i siti appositi.
Avevo visto nel tuo sito, nell’intestazione, che realizzi siti…
-
19 Gennaio 2012 alle 18:17 #92031Albert EinsteinPartecipante
Ho risolto grazie mille del suggerimento! Si realizzo siti, diciamo che ci sto provando, piano piano…
Grazie mille a presto!
-
21 Gennaio 2012 alle 4:15 #92177Albert EinsteinPartecipante
Titti ci sono riuscito a metterlo come volevo, il problema ora è che ogni volta che carico una pagina mi riparte il player da capo.
sai per caso come farlo partire in automatico solo io home, o per lo meno, che quando il lettore viene messo in pausa, rimanga in pausa?
grazie mille ciao
-
21 Gennaio 2012 alle 6:39 #92179EmmePartecipante
E’ ovvio che se la musica deve partire in automatico al caricamento della pagina, lo farà ogni volta che la pagina viene caricata e non solo quando lo desideri tu. Potresti ricorrere un frame (mi fa rabbrividire solo il termine). Tuttavia ti stai complicando la vita per una cosa sorpassata, oltremodo fastidiosa e che non c’entra nulla con i contenuti del tuo sito.
-
21 Gennaio 2012 alle 10:13 #92184Dudy_wpPartecipante
Concordo con Deep, eviterei di usare i frame (sono stato costretto a farlo per un cliente è non è affatto bello) piuttosto mettilo solo in home racchiudendo il codice in un bel
if(is_home()){
#Qui il codice
} -
21 Gennaio 2012 alle 10:21 #92185TittiModeratore
Concordo con Deep pure io, la musica che parte in automatico è anacronistica e fastidiosa, soprattutto in un sito che non ha niente a che fare con la musica. Ha senso in un sito di qualcuno che fa e propone musica.
Altro uso non inopportuno di un audio-player è a scopo didattico, come esempio per ciò di cui si parla, e senza partenza automatica, infatti non a caso nasce come player da inserire negli articoli non nel template, come ne ho visti diversi a corredo dell’argomento di cui si parla.
Concordo anche con Dudy, una condizione con if è una soluzione pulita.
-
21 Gennaio 2012 alle 12:21 #92211Albert EinsteinPartecipante
Grazie mille ragazzi per i preziosi consigli! Si l’idea dell’ IF HOME è quella che cercavo, però ho provato e non funziona, forse sbaglio qualcosa. Il codice che ho inserito in header.php ora è questo:
if(is_home()){
<?php if (function_exists(“insert_audio_player”)) {
insert_audio_player(“[audio:http://www.maurosilvestrone.com/musica/dido.mp3| autostart=yes]”);
} ?>
}
Giusto?
-
21 Gennaio 2012 alle 12:27 #92213Dudy_wpPartecipante
Sbagliato
<?php
if(is_home()){
if (function_exists("insert_audio_player")) {
insert_audio_player("[audio:http://www.maurosilvestrone.com/musica/dido.mp3| autostart=yes]");
}
}
?>sempre se non lo stai mettendo già all’interno di un <?php ?>, altrimenti ovviamente <?php ?> non serve
-
21 Gennaio 2012 alle 12:28 #92214Dudy_wpPartecipante
Ora che ci penso puoi anche eliminare un if…
<?php
if(is_home() && function_exists("insert_audio_player")){
insert_audio_player("[audio:http://www.maurosilvestrone.com/musica/dido.mp3| autostart=yes]");
}
?> -
21 Gennaio 2012 alle 12:37 #92215San PietroburgoPartecipante
Direi che abbiamo fatto progressi, da “Php se” siamo arrivati a spostare
<?php
in mezzo alla funzione.
Eppure questa roba dovrebbe essere simile al “pane quotidiano” per qualcuno che si qualifica con “realizzo siti”.
Da domani mi metto a fare il chirurgo plastico!
-
21 Gennaio 2012 alle 12:38 #92216Albert EinsteinPartecipante
Ok qualcosa è cambiato! ora non vedo il lettore! forse non riconosce la pagina home?
-
21 Gennaio 2012 alle 12:52 #92217Dudy_wpPartecipante
Vediamo… prova a mettere questo codice
if(is_home()) {echo "<h1>SONO LA HOME</h1>"; { else {echo "<h1>NO! NON SONO LA HOME!</h1>} ?>
e vedi cosa ti dice -
21 Gennaio 2012 alle 13:09 #92222TittiModeratore
Gli dice sicuramente errore di sintassi
@ Einstein, non avevi detto di avere una pagina home statica?
-
21 Gennaio 2012 alle 13:10 #92223Dudy_wpPartecipante
ah già la fretta…
<?php if(is_home()) {echo "<h1>SONO LA HOME</h1>";} else {echo "<h1>NO! NON SONO LA HOME!</h1>";} ?>
-
21 Gennaio 2012 alle 13:11 #92224Albert EinsteinPartecipante
L’ho inserito ma mi da errore di sintassi.
Prova a farmi un esempio completo con tutto il codice del player, per non incorrere in ulteriori incomprensioni od errori. Grazie mille.
-
21 Gennaio 2012 alle 13:12 #92227Dudy_wpPartecipante
ti ho risposto mentre rispondevi
-
21 Gennaio 2012 alle 13:15 #92229Albert EinsteinPartecipante
Si mi dice che non è la home page! Si titti io sto utilizzando una pagina statica!
-
21 Gennaio 2012 alle 13:17 #92230TittiModeratore
E allora metti il codice nella pagina statica se vuoi il player solo là¬
-
21 Gennaio 2012 alle 13:21 #92231Dudy_wpPartecipante
ok, allora sostituisci nel codice is_home() con is_page(‘nome della home’) e vedi se ti dice che è la home
-
21 Gennaio 2012 alle 13:27 #92233Albert EinsteinPartecipante
OK! MISSIONE COMPIUTA! AHAHAH
ecco il codice esatto:
<?php
if(is_page(Home) && function_exists(“insert_audio_player”)){
insert_audio_player(“[audio:http://www.maurosilvestrone.com/musica/dido.mp3| autostart=yes]”);
}
?>
Grazie mille dudy e titti, per questi suggerimenti preziosi.
P.S. il discorso della pagina statica non l’ho capito. cioè non saprei dove trovarla all’interno dei vari file di wordpress.
-
21 Gennaio 2012 alle 13:33 #92234Dudy_wpPartecipante
Prego figurati comunque tutte le pagine che non usano un template diverso, usano il file page.php per essere visualizzate, in ogni caso hai risolto quindi non ti serve modificare altro
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.