Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@EranSch
Created September 15, 2016 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EranSch/a00fb17210c39923e6df9a18da4285b4 to your computer and use it in GitHub Desktop.
Save EranSch/a00fb17210c39923e6df9a18da4285b4 to your computer and use it in GitHub Desktop.
hack
$cat_counts = (new F\MaybeEmpty($full_query->get_posts()))
->bind($posts ==> array_map($p ==> wp_get_post_categories($p->ID), $posts))
->bind('tft\fp\flatten')
->bind($cats ==> F\reduce($cats, function($carry, $id) {
$carry[$id]++;
return $carry;
}), [])
->extract();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment