Risposte nei forum create
-
AutorePost
-
NappaPartecipante
MITICI… funziona tutto alla perfezione
anche se il sito e’ in progress, ecco l’indirizzo
http://www.decimamusa.it/associazione/
GRAZIE A TUTTI
NappaPartecipantemah… ho risolto, anche se penso non nel modo più veloce…
cosଠfunziona e mi restituisce il thumbnail dell’ID random trovato
Grazie ragazzi
$imagesRand = $wpdb->get_results( “SELECT ID FROM $wpdb->posts WHERE post_type = ‘attachment’ ORDER BY RAND() LIMIT 6” );
//print_r($imagesRand); — DEBUD
foreach ($imagesRand as $imageRand) {
$imageScrollID = $imageRand->ID;
$hilite = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE ID = $imageScrollID” );
echo ” . wp_get_attachment_image( $hilite, ‘scroll-thumbnail’ ) . ”;
}
NappaPartecipante… perdonatemi, ma se…
$hilite = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE post_type = ‘attachment’ ORDER BY RAND() LIMIT 6” );
echo ” . wp_get_attachment_image( $hilite, ‘scroll-thumbnail’ ) . ”;
… faccio
print_r($hilite);
dovrebbe stamparmi in contenuto dell’array, giusto?
mi da solo un numero
NappaPartecipante…acc… ci avevo già pensato, ma ne mette sempre 1… non ci vuole qualche loop tipo foreach ()?
NappaPartecipante… devo dire che wordpress è un prodotto fantastico, ma anche le persone che lo usano lo sono
Grazie infinite per la soluzione, è proprio quello che mi serviva…
mi rimane solo un dubbio:
Avrei bisogno di selezionare più di una immagine a caso (direi 6), riesci a scrivermi la sintassi?
grazie 1000…
altra cosina, ma penso di cavarmela con qualche ricerca, le immagini devono essere strette e alte, quindi ho aggiunto del codice nel file function.php del tema per aggiungere un thumbnail diverso.
80×195 facendo un hard crop, ma ovviamente non funzia
add_image_size( ‘scroll-thumbnail’, 80, 195, true );
-
AutorePost