Sometimes we want to show wordpress posts according to our demanded styles. For example, we like to show 10 posts, and post links resource codes should like this:
<a title=”king php” href=http://www.kingphp.com>king php</a>
We can do as following:
<ul>
 <?php
 $rand_posts = get_posts(‘numberposts=10&orderby=rand’);
 foreach( $rand_posts as $post ) :
 ?>
   <li><a title=”<?php the_title(); ?>” href=”<?php the_permalink(); ?>”> <?php the_title(); ?></a></li>
 <?php endforeach; ?>
</ul>
</div>Â
If we want to show all posts according to post titles, from a to z:
 <ul><li><h2>A random selection of my writing</h2>
   <ul>
 <?php
 $rand_posts = get_posts(‘numberposts=-1&orderby=title&order=ASC’);
 foreach( $rand_posts as $post ) :
 ?>
   <li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
 <?php endforeach; ?>
   </ul>
 </li></ul>
We can find more skills at http://codex.wordpress.org/Template_Tags/get_posts