List 50 posts of wordpress.

If you want to list 50 posts, use the following code: <ul>  <?php  global $post;  $myposts = get_posts(‘numberposts=-1’);  foreach($myposts as $post) :  ?>     <li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>  <?php endforeach; ?>  </ul> if you want to list all… Read moreList 50 posts of wordpress.

WordPress Random posts

Display a list of 15 posts selected randomly by using the MySQL RAND() function for the orderby parameter value:  <ul><li><h2>A random selection of kingphp posts</h2>     <ul>  <?php  $rand_posts = get_posts(‘numberposts=15&orderby=rand’);  foreach( $rand_posts as $post ) :  ?>     <li><a… Read moreWordPress Random posts

Add Random Posts in a Page

get_posts() can be used to collect and display any number of random posts you want. Here’s an example that lists the titles (as links) of four random posts: <ul><li><h2>Some Random Posts</h2> <ul> <?php $rand_posts = get_posts(‘numberposts=4&orderby=RAND()’); foreach( $rand_posts as $post… Read moreAdd Random Posts in a Page

Get certain number posts

<?php $posts = get_posts( “category=1&numberposts=10″ ); ?> <?php if( $posts ) : ?> <ul><?php foreach( $posts as $post ) : setup_postdata( $post ); ?> <li> <a href=”<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></a> </li> <?php endforeach; ?> </ul>… Read moreGet certain number posts