Created
December 27, 2014 17:28
-
-
Save kreamweb/3713a65fc997d9322431 to your computer and use it in GitHub Desktop.
[Wordpress] Limit the Number of tags in a widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Register tag cloud filter callback | |
add_filter('widget_tag_cloud_args', 'tag_widget_limit'); | |
//Limit number of tags inside widget | |
function tag_widget_limit($args){ | |
//Check if taxonomy option inside widget is set to tags | |
if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){ | |
$args['number'] = 20; //Limit number of tags | |
} | |
return $args; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment