Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getMostUsedTaxonomies($taxonomy, $fields = 'all', $orderBy = 'count', $orderDirection = 'desc', $limit = '30') {
- $transientName = 'mostUsedTaxonomies_'.$taxonomy.'_'.$fields.'_'.$orderBy.'_'.$orderDirection.'_'.$limit;
- $mainTechnologies = get_transient( $transientName );
- if ( $mainTechnologies === false ) {
- $params = array(
- 'taxonomy' => $taxonomy,
- 'hide_empty' => true,
- 'orderby' => $orderBy,
- 'order' => $orderDirection,
- 'number' => $limit,
- 'fields' => $fields
- );
- $mainTechnologies = get_terms($params);
- set_transient($transientName, $mainTechnologies, 60*60*24);
- }
- return $mainTechnologies;
- }
Add Comment
Please, Sign In to add comment