Home › Forum › Problemi Vari con WP › Immagini nei temi
-
AutorePost
-
-
11 Dicembre 2011 alle 9:07 #20008zocPartecipante
Ciao a tutti,
non riesco a capire cosa sbaglio, ma, creando un nuovo tema, le immagini dichiarate nei css funzionano, mentre quelle inserite nel codice no.
Faccio un esempio:
/images/foto.png // non funziona!
<?=bloginfo('template_url');?>/images/foto.png // funziona
sapete come mai?
PS: io uso mac con MAMP
grazie mille!
-
11 Dicembre 2011 alle 9:28 #90570SteveAglAmministratore del forum
perchè la prima da un percorso relativo e la seconda no ?
-
11 Dicembre 2011 alle 10:10 #90571zocPartecipante
nel senso che se metto
src="/images/foto.png" />
non mi visualizza l’immagine, mentre se metto
src=<?=bloginfo('template_url');?>/images/foto.png" />
me lavisualizza.
Ma penso ci sia qualcosa di sbagliato, perchè anche la prima mi dovrebbe andare, no?
Grazie!
-
11 Dicembre 2011 alle 10:43 #90572SteveAglAmministratore del forum
Ovviamente no…. visto che le imamgini del tema sono nella cartella del tema e se metti /images/qualchecosa nella pagina di sito.com verrà presa come sito.com/images/qualchecosa… suggerisco di studiare i percorsi relativi ed assoluti delle immagini ed altro in html… e magari farsi venire la curiosità di capire che cosa è bloginfo(‘template_url’)
PS: aprire i tag php con la formula abbreviata (<? è male.. anzi malissimo
-
11 Dicembre 2011 alle 11:49 #90577zocPartecipante
forse mi sono espresso male… la cartella images sopracitata è presente all’interno della mia directory del tema:
installazioneWP > wp-content > themes > mioThema > images.
So bene che cosa è bloginfo(‘template_url’); e sto usando quello perchè il percorso relativo (images/miaimmagine.png) non mi funziona e volevo capire perchè
-
11 Dicembre 2011 alle 12:19 #90580wollyAmministratore del forum
Ovviamente no…. visto che le imamgini del tema sono nella cartella del tema e se metti /images/qualchecosa nella pagina di sito.com verrà presa come sito.com/images/qualchecosa… suggerisco di studiare i percorsi relativi ed assoluti delle immagini ed altro in html.
-
11 Dicembre 2011 alle 12:22 #90581zocPartecipante
quindi è corretto utilizzare bloginfo(‘template_url’); oppure funziona si, ma non è da manuale di WP?
grazie!
-
11 Dicembre 2011 alle 12:26 #90582zocPartecipante
forse ho un altra soliuzione.
Ovvero visto che sto lavorando in locale e nella root principale del server ho diversi siti, allora gli cambio il path, che penso si faccia da wp-config.php, ovvero:
/** Path assoluto alla directory di WordPress. */
if ( !defined(‘ABSPATH’) )
define(‘ABSPATH’, dirname(__FILE__) . ‘/’);
giusto?
grazie!
-
11 Dicembre 2011 alle 12:43 #90583zocPartecipante
non funziona
voi come la risolvete la cosa nei vostri temi?
grazie!
-
11 Dicembre 2011 alle 17:07 #90588SteveAglAmministratore del forum
conl a template url come tutti i millemilamioni di temi.. aprine u qualcuno e guarda no? non mi pare difficile… quel che vuoi fare tu non l’ho capito ma di certo i path relativi NON funzionano
-
12 Dicembre 2011 alle 6:17 #90601zocPartecipante
aprine u qualcuno e guarda no? non mi pare difficile…
se non lo fosse non farei la domanda
Provo a porre la domanda in maniera diversa.
Dentro la directory del mio server in locale ho diversi siti.
Lo so che se mettessi la mia cartella images nella root funzionerebbe, ma non posso perchè come dicevo ho diversi siti.
Cè un modo per dire a wp che la directory root è http://localhost:8888/wordpress/ e non http://localhost:8888/?
grazie
-
12 Dicembre 2011 alle 7:17 #90605SteveAglAmministratore del forum
VOlendo si può fare quasi tutto ma se ti è difficile aprire un file php figuriamoci giocare coi htaccess rewrite rule etc… davvero NON capisco quale sia il problema visto che basta mettere url assoluti e NON relativi… ma andiamo avanti cosଠaperdere tempo!
-
14 Dicembre 2011 alle 7:36 #90725zocPartecipante
io sicuramente non sono un esperto, ma che tu non capisca l’utilità di avere percorsi relativi in fase di sviluppo del tuo tema, cosଠcome nel prodotto finale… mi lascia perplesso.
Fa nulla, grazie lo stesso.
-
14 Dicembre 2011 alle 8:34 #90729SteveAglAmministratore del forum
Visto che il tema di WP sta in un determinato posto SEMPRE, che WP ha una data struttura e tu NON sei un esperto, non capisco come tu non riesca a capire che in questo caso SI DEVE FARE COSI’… comunque continua a voler fare di testa tua.. auguri.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.