ottenere l'URL dell'allegato per l'immagine di medie dimensioni
3 risposta
- voti
-
- 2012-03-09
wp_get_attachment_url()
restituirà solo l'URL alfile allegato originale,questafunzione accetta solo l'ID dell'allegato comeparametro.Utilizza
wp_get_attachment_image_src()
owp_get_attachment_image()
invece.wp_get_attachment_url()
will only return url to original attachment file, this function only accepts attachment id as parameter.Use
wp_get_attachment_image_src()
orwp_get_attachment_image()
instead.-
nessuno di questi sembra restituire l'url anche se vero?neither of those seem to return the url though do they?
- 1
- 2012-03-12
- JorgeLuisBorges
-
`wp_get_attachment_src ()` restituisce arraye ilprimoparametro è l'URL dell'immagine.Vedi lapagina del codice collegatapermaggiori dettagli.`wp_get_attachment_src()` returns array and first parameter is image url. See linked codex page for more details.
- 1
- 2012-03-12
- Mamaduka
-
-
_Function array dereferencing_ è unafunzionalità di PHP 5.4+.Non che questo dovrebbeessere unproblema.Soloperfar sapere a chiunque._Function array dereferencing_ is a PHP 5.4+ feature. Not that this should be a problem. Just to let anyone know.
- 3
- 2015-08-19
- tfrommen
-
-
- 2020-04-03
Non so come la risposta sopra sia la risposta.
wp_get_attachment_image_src
richiede l'ID dell'allegatonon l'ID delpost.<?php echo esc_url((wp_get_attachment_image_src( get_post_thumbnail_id(get_the_id()), 'medium')[0])?>
I don't how above answer makes the answer.
wp_get_attachment_image_src
need attachment id not post id.<?php echo esc_url((wp_get_attachment_image_src( get_post_thumbnail_id(get_the_id()), 'medium')[0])?>
Ciao,sto usando del codiceper creare unapresentazione confunzionalità lytebox:il codice seguente viene utilizzatonel cicloperestrarrein sequenza ciascunaimmagine allegata a unpost.
Sembra che stia solotirando l'immaginegrande,anche se hoimpostatoil valore sumedio - qualsiasiidea su comeposso ottenere .wp_get_attachment_url ($ attachment-> ID,'medium',false,false) datirare leimmagini dimedie dimensioni?
grazie
}