Implementing get_categories_posts function (Tests successful)