Created
August 16, 2019 15:24
-
-
Save Farmatique/c7e90f2107de21663e27673f125cbf58 to your computer and use it in GitHub Desktop.
Get index within Wordpress posts loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $index = 0; while (have_posts()) : the_post(); ?> | |
<?php get_template_part('partials/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?> | |
<div class="temp-index"><?=$index;?></div> | |
<?php $index++;endwhile; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment