WordPress: Un post a caso …
Facendo un giroingiro tra i blog , ho notato che in alcuni è presente una simpatica funzione che visualizza i titoli di un numero determinato di articoli pescandoli a caso tra quelli già pubblicati.
Quindi mi sono detto: “carina questa cosa …. la voglio anch’io “.
Dopo aver pestato i piedi per terra per 2 minuti senza nessun risultato , ho chiesto google : “wordpress random posts” ed in modo molto gentile mi ha risposto : “vai su questo sito , scarica e installa il plugin “.
Ho quindi scaricato in locale il plugin , caricato il file php su wordpress , attivato il plugin tramite l’amministrazione ed infine modificato la mia sidebar in modo che chiamasse la funzione.
Questo il contenuto del file readme allegato nel quale vengono spiegati i vari parametri :
random_posts($limit, $len, $before_title, $after_title, $before_post, $after_post, $show_pass_post, $show_excerpt);
$limit – No. of posts to show.
$len – Lenght of auto-generate excerpt.
$before_title – Text to appear before the entry title.
$after_title – Text to appear after the entry title.
$befor_post – Text to appear before the entry excerpt.
$after_post – Text to appear after the entry excerpt.
$show_pass_post = Include/exclude password protected entries (Default: false).
$show_excerpt = Show/hide excerpt (Default: false).
Questi invece è il codice che ho aggiundo nella side bar
<?php random_posts( 10, 0, "<li>» "); ?>