daily pastebin goal
74%
SHARE
TWEET

Untitled

a guest Feb 15th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function getMostUsedTaxonomies($taxonomy, $fields = 'all', $orderBy = 'count', $orderDirection = 'desc', $limit = '30') {
  3.     $transientName = 'mostUsedTaxonomies_'.$taxonomy.'_'.$fields.'_'.$orderBy.'_'.$orderDirection.'_'.$limit;
  4.     $mainTechnologies = get_transient( $transientName );
  5.     if ( $mainTechnologies === false ) {
  6.         $params = array(
  7.             'taxonomy' => $taxonomy,
  8.             'hide_empty' => true,
  9.             'orderby' => $orderBy,
  10.             'order' => $orderDirection,
  11.             'number' => $limit,
  12.             'fields' => $fields
  13.         );
  14.         $mainTechnologies = get_terms($params);
  15.         set_transient($transientName, $mainTechnologies, 60*60*24);
  16.     }
  17.     return $mainTechnologies;
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top