Post styling hooks for fetched posts
-
In order to allow differential styling of posts i normally add an incremental $count to my loops
Something like:
$count = 0; //set up counter variable while (have_posts()) : the_post(); $count++; //increment the variable by 1 each time the loop executes $html = "<article class=\"post-{$count}\">'"; ... endwhile;
This allows me to output:
<article class="post-1">...</article>
<article class="post-2">...</article>
However, I’m unable to use this method with Infinite-Scroll as the count is reset with each ajax fetch.
Anyone found a work around for it?
- The topic ‘Post styling hooks for fetched posts’ is closed to new replies.