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

list all posts

<h3>Posts</h3> <ul>                 <?php while(have_posts()) : the_post(); ?> <?php foreach((get_the_category()) as $category)                           { $my_query = new WP_Query(‘category_name=’ . $category->category_nicename . ‘&orderby=title&order=asc&showposts=100’);} ?>                        <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>        <li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></li>… Read morelist all posts