Don’t run the query twice. Use get_posts($args)
instead of new WP_Query
. Then use array_slice()
to generate to arrays of equal length and loop through them that way.
array_slice()
help:
https://stackoverflow.com/questions/5393028/how-can-i-take-an-array-divide-it-by-two-and-create-two-lists