title: Wordpress: get current_post index number in WHILE loop
body: <p>How to get current post <code>index number</code> inside WHILE loop?</p>
  
  <pre><code>$index_query = new WP_Query( array( 'post_type' =&gt; 'post', 'orderby' =&gt; 'modified', 'posts_per_page' =&gt; '-1', 'order' =&gt; 'DESC' ) );
  while ( $index_query-&gt;have_posts() ) : $index_query-&gt;the_post();
  
      // echo current post index number
  
  endwhile;
  </code></pre>
  
  <p>Have tried with the following, but no result.</p>
  
  <pre><code>$index_query-&gt;post-&gt;current_post;
  </code></pre>
  
  <p>Any suggestions much appreciated!</p>