title: Returning a random post with get_posts(); in Wordpress
body: <p>I am currently trying to return one random post from a custom post type in Wordpress. Currently, all it returns is the last post posted within that custom post type. I am currently using this code to get the posts:</p>
  
  <pre><code>&lt;?php $posts = get_posts(array('posts_per_page' =&gt; 1, 'order_by' =&gt; 'rand', 'order' =&gt; 'ASC', 'post_type' =&gt; 'call_to_action')); if( $posts ): ?&gt;
    &lt;?php foreach ( $posts as $post ) : setup_postdata( $post ); ?&gt;
      // Some code
    &lt;?php endforeach; ?&gt;
    &lt;?php wp_reset_postdata(); ?&gt;
  &lt;?php endif; ?&gt;
  </code></pre>