Home » Wordpress Tips

Randomize wordpress post order

6 June 2009 2 Comments

random-post-wordpress

Spesso può tornare utile, a seconda del tipo di blog o sito che stiamo realizzando, la funzione di WordPress, che permette di ordinare i post del nostro blog in modo casuale o random.

Per ordinare in modo casuale i post del nostro blog, dobbiamo utilizzare la funzione query_posts() prima del loop di WordPress, modificando la funzione come segue:

query_posts(‘orderby=rand’);//Your loop goes here

Oppure possiamo anche definire una categoria specifica per ordinare i post del nostro blog in modo random, indicando l’ID della categoria.

query_posts(‘cat=10&orderby=rand’);//Your loop goes here

Questo post è stato tratto da una ricetta per wordpress.

2 Comments »

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Spam Protection by WP-SpamFree Plugin