Dr-wordpress : Today i am going to share a method of showing random POST in any word press page..just like QUIZ example or Captacha.You can also use it on different places where you want to show random POST's in wordpress...
wp_reset_query();
query_posts("post_type=blog&posts_per_page=1&orderby=rand");
while ( have_posts() ) : the_post();
$post_thumbnail_id = get_post_thumbnail_id( get_the_id() );
$url=wp_get_attachment_image_src( $post_thumbnail_id,"medium" );
?>
<h1><?php the_title() ?></h1>
No comments:
Post a Comment