Timeline for Post data in separate divs with incrementing class using WP_Query
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 20, 2014 at 8:40 | comment | added | Pieter Goosen | Glad you were able to solve your problem. Enjoy :-) | |
Sep 20, 2014 at 8:31 | vote | accept | nimsrules | ||
Sep 20, 2014 at 8:31 | comment | added | nimsrules | That did it.. Thank you so much Pieter. I removed both my for loops and replaced $i and $j with $locationsLoop->current_post, although I had to keep both the WP_Querys because of the separate divs structure. | |
Sep 19, 2014 at 5:36 | comment | added | Pieter Goosen |
I am currently at work, so can't test anything. But I would suggest to use only one query, using two is definitely your problem here. As I suggested, use the build in counters. Just one note, if you use a custom query, as you did, and the variable assigned to WP_Query is $locationsLoop as it is in your case, your loop counter can be accessed by $locationsLoop->current_post
|
|
Sep 19, 2014 at 5:11 | comment | added | nimsrules | Even after moving wp_reset_postdata() after endwhile, I'm getting the content generated 8 times where 8 = $count_posts | |
Sep 19, 2014 at 4:28 | comment | added | Pieter Goosen | See my edit :-) | |
Sep 19, 2014 at 4:27 | history | edited | Pieter Goosen | CC BY-SA 3.0 |
Add edit
|
Sep 19, 2014 at 4:02 | comment | added | nimsrules | Thank you, that explains how can I improve the counter. What I'm looking for is to remove the extra content being generated due to my faulty for loop (I guess). Any insight on that? | |
Sep 19, 2014 at 3:55 | history | answered | Pieter Goosen | CC BY-SA 3.0 |