Skip to content

Instantly share code, notes, and snippets.

@espiat
Created November 9, 2017 11:35
Show Gist options
  • Save espiat/49dd11afd8faee3f9547041738be9d50 to your computer and use it in GitHub Desktop.
Save espiat/49dd11afd8faee3f9547041738be9d50 to your computer and use it in GitHub Desktop.
Description
Filter the widget_tag_cloud_args.
apply_filters( 'widget_tag_cloud_args',
array(
'taxonomy' => $current_taxonomy,
'echo' => false
) ) );
Parameters
$args = array(
'smallest' => 12,
'largest' => 18,
'unit' => 'pt',
'number' => 10,
'format' => 'flat',
'separator' => "\n",
'orderby' => 'name',
'order' => 'ASC',
'exclude' => '',
'include' => '',
'link' => 'view',
'taxonomy' => $current_taxonomy,
'post_type' => '',
'echo' => false
);
By default, the usage shows:
smallest - The smallest tag (lowest count) is shown at size 8
largest - The largest tag (highest count) is shown at size 22
unit - Describes 'pt' (point) as the font-size unit for the smallest and largest values
number - Displays at most 45 tags
format - Displays the tags in flat (separated by whitespace) style
separator - Displays whitespace between tags
orderby - Order the tags by name
order - Sort the tags in ASCENDING fashion
exclude - Exclude no tags
include - Include all tags
link - view
taxonomy - Use post tags for basis of cloud
echo - echo the results
Examples
Include specific tag i.d's in tag cloud widget
add_filter( 'widget_tag_cloud_args', 'filter_tag_cloud_widget' );
function filter_tag_cloud_widget() {
$include = array( 58, 59 );
$args = array(
'include' => $include,
'taxonomy' => $current_taxonomy,
'echo' => false,
);
return $args;
}
Source File
widget_title is located in wp-includes/widgets/class-wp-widget-tag-cloud.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment