Title: falarious's Replies | WordPress.org

---

# falarious

  [  ](https://wordpress.org/support/users/falarious/)

 *   [Profile](https://wordpress.org/support/users/falarious/)
 *   [Topics Started](https://wordpress.org/support/users/falarious/topics/)
 *   [Replies Created](https://wordpress.org/support/users/falarious/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/falarious/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/falarious/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/falarious/engagements/)
 *   [Favorites](https://wordpress.org/support/users/falarious/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Random Daily Post?](https://wordpress.org/support/topic/random-daily-post/)
 *  Thread Starter [falarious](https://wordpress.org/support/users/falarious/)
 * (@falarious)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/random-daily-post/#post-1449539)
 * Finally got something to work.
    $d will get the day of the year.
 * WP_Query(‘p=’.$d.”)
    Gets the post ID according to the day of the year.
 * Its not really random, but it will do for now.
 *     ```
       <h2 class="widgettitle">Daily Post</h2>
       <?php $d = date('z'); ?>
          <?php $my_query = new WP_Query('p='.$d.''); ?>
             <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
                 <div class="post" id="post-<?php the_ID(); ?>">
       	   <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> <br /> <?php the_content(); ?>
       			</div>
       <?php endwhile; ?>
       ```
   
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Random Daily Post?](https://wordpress.org/support/topic/random-daily-post/)
 *  Thread Starter [falarious](https://wordpress.org/support/users/falarious/)
 * (@falarious)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/random-daily-post/#post-1449528)
 * I don’t want a random post each time I refresh the page.
 * I want only 1 random post to be chosen for the day, and kept there for the rest
   of the day.
 * Come tomorrow, it will pick another random post.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Random Daily Post?](https://wordpress.org/support/topic/random-daily-post/)
 *  Thread Starter [falarious](https://wordpress.org/support/users/falarious/)
 * (@falarious)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/random-daily-post/#post-1449526)
 *     ```
       <?php
   
           $args=array(
             'id'=>'1',
             'post_type' => 'post',
             'post_status' => 'publish',
             'posts_per_page' => 1,
             'caller_get_posts'=> 1
             );
           $my_query = null;
           $my_query = new WP_Query($args);
           if( $my_query->have_posts() ) {
             echo 'List of Posts';
             while ($my_query->have_posts()) : $my_query->the_post(); ?>
             <br /><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br /><?php the_content(); ?>
              <?php
             endwhile;
           }
       wp_reset_query();  // Restore global post data stomped by the_post().
       ?>
       ```
   
 * I have that code and it pulls the post with ID=1. How can I make it so that it
   will pull a random post, every day.

Viewing 3 replies - 1 through 3 (of 3 total)