8, // font size for the least used tag 'largest' => 22, // font size for the most used tag 'unit' => 'px', // font sizing choice (pt, em, px, etc) 'number' => 45, // maximum number of tags to show 'format' => 'flat', // flat, list, or array. flat = spaces between; list = in li tags; array = does not echo results, returns array 'orderby' => 'name', // name = alphabetical by name; count = by popularity 'order' => 'ASC', // starting from A, or starting from highest count 'exclude' => 12, // ID's of tags to exclude, displays all except these 'include' => 13, // ID's of tags to include, displays none except these 'link' => 'view', // view = links to tag view; edit = link to edit tag 'taxonomy' => 'post_tag', // post_tag, link_category, category - create tag clouds of any of these things 'echo' => true // set to false to return an array, not echo it ) ); ?>
Kích thước mặc định, nếu không được cung cấp, cho chức năng này là "pt", hơi bất thường và thường không đáng tin cậy, vì vậy hãy đảm bảo bạn thay đổi thông số đó thành cách bạn định kích thước phông chữ bình thường trên trang web của mình.
Kích thước phông chữ ít kỳ lạ hơn
Các đám mây thẻ thực hiện các kích thước phông chữ đa dạng của chúng bằng cách áp dụng kiểu nội tuyến cho mỗi thẻ. Các kích thước phông chữ kết quả có thể thực sự kỳ lạ như style = 'font-size: 29.3947354754px;'. Mike Summers đề xuất giải pháp này:
8, // font size for the least used tag 'largest' => 40, // font size for the most used tag 'unit' => 'px', // font sizing choice (pt, em, px, etc) 'number' => 200, // maximum number of tags to show 'format' => 'array', // flat, list, or array. flat = spaces between; list = in li tags; array = does not echo results, returns array 'separator' => '', // 'orderby' => 'name', // name = alphabetical by name; count = by popularity 'order' => 'RAND', // starting from A, or starting from highest count 'exclude' => '', // ID's of tags to exclude, displays all except these 'include' => '', // ID's of tags to include, displays none except these 'link' => 'view', // view = links to tag view; edit = link to edit tag 'taxonomy' => 'post_tag', // post_tag, link_category, category - create tag clouds of any of these things 'echo' => true // set to false to return an array, not echo it )); foreach ($arr as $value) ( $ptr1 = strpos($value,'font-size:'); $ptr2 = strpos($value,'px'); $px = round(substr($value,$ptr1+10,$ptr2-$ptr1-10)); $value = substr($value, 0, $ptr1+10) . $px . substr($value, $ptr2); $ptr1 = strpos($value, "class="); $value = substr($value, 0, $ptr1+7) . 'color-' . $px . ' ' . substr($value, $ptr1+7); echo '
- ' . $value . '
'; ) ?>
Kết quả biến điều này thành:
Tag Name
vào cái này:
Tag Name
Lưu ý phần thưởng thêm rằng các liên kết có tên lớp là “color-29” bây giờ mà nó không có trước đây. Bây giờ bạn có một hook để tô màu các tên thẻ dựa trên kích thước của chúng.