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

How to use mod rewrite forward to a new domain?

For examples, when we visit www.google.com, we want it redirect to http://kingphp.com, we can use the following code: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] The code posted above should be used on the old server.

How to redirect folders (and all the link)

For example, if we want to redirct http://kingphp.com/php/ to http://kingphp.com/wordpress/ We could use mod_rewrite. Put this in your .htaccess file Options +FollowSymLinks RewriteEngine On RewriteRule /php/(\w+).html /wordpress/$1.html [R=301,L]