Create a gist now

Instantly share code, notes, and snippets.

To call the function I do something like this:
$cat = '2,6,3,4,12,11,17,16,125,1,13,9,7,15,49,51';
$posts = get_popular_posts_array( array( 'range' => 'all', 'limit' => 24, 'cat' => $cat, 'pid' => '2694,2696,2699' ) );
And then I do a foreach using the $posts array. This way I can even use it twice or as many times as I want without repeating the query.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment