title: Wordpress get_posts() offset by finding index of post by slug
body: <p>I'm building a Wordpress page which aggregates all posts of a type (press-post).</p>
  
  <p>I want to be able to pass in a URL parameter of a post, which will offset the query to start at the index of the post slug.</p>
  
  <p>For example, <code>www.mysite.com/press</code> should start at offset 0, where as <code>www.mysite.com/press?post=third-post-slug</code> should query at offset 2.</p>
  
  <p>How can I find the offset of a post in a query by its slug?</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>if ($_GET['post']):
      $post_offset = // Here I need to get the offset of that post in the query;
    else:
      $post_offset = 0;
    endif;
  
    $args = array(
      'post_type'       =&gt; 'press',
      'post_status'     =&gt; 'publish',
      'posts_per_page'  =&gt; 15,
      'offset'          =&gt; $post_offset,
      'paged'           =&gt; $page_no,
      'orderby'         =&gt; 'date',
      'order'           =&gt; 'DESC',
    );
  
    $press_posts = get_posts($args);
  </code></pre>