• Skip to main content

Victor Font Consulting Group, LLC

The DEX Intranet Specialists

Call Us:

+1 919-604-5828

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network
You are here: Home / Code Snippet / WordPress Tag Cloud Font Size

WordPress Tag Cloud Font Size

By Victor M. Font Jr.
February 8, 20162 Comments

Adjust WordPress Tag CLoud Font Size image

A poster recently asked, "How do I change the font size for the tag cloud widget? I can't find the CSS in my theme's style sheet."

The WordPress tag cloud plugin provides a visual representation of text data, used to depict post tags or categories on WordPress powered websites. This is an independent WordPress function. Themes designed for WordPress do not have CSS in their style sheets for formatting the WordPress tag cloud. The CSS for the tag cloud is built into the WordPress wp_tag_cloud() function, which is found in wp-includes/category-template.php. By design, the size of each tag is determined by how many times that particular tag has been assigned to posts. The font-size dimension is assigned to each tag at run time as inline CSS. There is no style sheet.

That being said, it is easy to change the sizes for tags using the widget_tag_cloud_args filter. There are two dimensions to change, smallest and largest. Add the following code to functions.php and set the size as you like it. The defaults are 8px for smallest and 22px for largest. In the example below, the smallest is set to 12px and the largest to 19px.

Parameters

Parameters that may be included in the above function are:

  • 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
  • topic_count_text_callback—Uses function default_topic_count_text (deprecated)
  • link—view
  • taxonomy—Use post tags for basis of cloud
  • echo—echo the results

For further reerence, visit the wp_tag_cloud() page in the WordPress Codex: Here’s a link to the reference: http://codex.wordpress.org/Function_Reference/wp_tag_cloud

  • 7shares
  • Facebook0
  • Twitter0
  • Pinterest1
  • LinkedIn6
  • Print
  • SMS0

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

Reader Interactions

VictorFont.com runs on the Genesis Framework

Genesis FrameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Check out the incredible features and the selection of designs. It's that simple—start using Genesis now!

Click here to download The Genesis Guide for Absolute Beginners (PDF - 1.4 MB)

Leave a Reply Cancel reply

Your email address and website will not be published. Required fields are marked *
Posting a comment means that you agree with and accept our Comment & Product Review Policy

Comments

  1. Akram

    June 26, 2017 at 7:58 am

    Hi, I read your post regarding how to control the size of the font inside the tag widget for WP tags, i hope you can help me in controling the size of the font in the Woocommerce Product Tag Widget.

    Reply
    • Victor M. Font Jr.

      June 26, 2017 at 2:24 pm

      None of my customers have ever asked for a change to the font size for Woocommerce Product Tag Widget. So I looked through the source code for the widget and it just calls the WordPress wp_tag_cloud() function. It passes the woocommerce_product_tag_cloud_widget_args filter to the WordPress function as a parameter. I have not tested this code, but the snippet below will get you pointed in the right direction:

      add_filter( 'woocommerce_product_tag_cloud_widget_args', 'my_custom_product_tag_cloud_args');
      function my_custom_product_tag_cloud_args( $args ) {
      $args['smallest'] = 12; /* Set the smallest size to 12px */
      $args['largest'] = 19; /* set the largest size to 19px */
      return $args;
      }

      Reply

Call: +1 919-604-5828

Send us an E-mail

Accessibility Statement | Affiliate Marketing Disclosure | Capability Statement

Cookie Policy | Comment & Product Review Policy | Privacy Policy | Site Map | Terms & Conditions

Copyright © 2003–2023 Victor M. Font Jr.

Return to top of page