0

This code reads the category number from the array $catID. For each Category in $catID, the code queries only the first $rowLimit posts. Then it merges each query ($thisquery) into $lastposts.

foreach ($catID as $thiscatID)
{
    if (is_numeric($thiscatID))
    {
        $post_args['cat'] = $thiscatID;
        $post_args['post_type'] = $postType;
        if ($rowLimit)
        {
            $post_args['numberposts'] = $rowLimit;
        }
        $thisposts = get_posts($post_args);
        $lastposts = array_merge($lastposts, $thisposts);   
    }
}

But then, I must sort the $lastposts array by date, and I have no clues how I can do that.

hakre
  • 184,866
  • 48
  • 414
  • 792
user1232551
  • 53
  • 1
  • 8

0 Answers0