Home > CMS Tutorial > WordPress > body text

How to implement a colored tag cloud in WordPress

angryTom
Release: 2019-11-16 11:51:09
Original
2323 people have browsed it

How to implement a colored tag cloud in WordPress

How does WordPress implement a colored tag cloud

Colored tag cloud We can see this type of thing on many websites Effect, here is how to add the color tag cloud effect in wordpress.

This colorful tag cloud effect can be displayed by modifying Simple Tags.

1. First find the following code in simple-tags.client.php:

function getColorByScale($scale_color, $min_color, $max_color)
Copy after login

2. Comment out (or delete) the getColorByScale function The following statement:

$scale_color = $scale_color / 100; 
$minr = hexdec(substr($min_color, 1, 2)); 
$ming = hexdec(substr($min_color, 3, 2)); 
$minb = hexdec(substr($min_color, 5, 2)); 
$maxr = hexdec(substr($max_color, 1, 2)); 
$maxg = hexdec(substr($max_color, 3, 2)); 
$maxb = hexdec(substr($max_color, 5, 2)); 
$r = dechex(intval((($maxr - $minr) * $scale_color) + $minr)); 
$g = dechex(intval((($maxg - $ming) * $scale_color) + $ming)); 
$b = dechex(intval((($maxb - $minb) * $scale_color) + $minb));
Copy after login

3. Add the following code:

//Colorful Tag Cloud start 
$r = dechex(rand(0,255)); 
$g = dechex(rand(0,196)); 
$b = dechex(rand(0,255));
Copy after login

Colorful Tag Cloud end As for how many tags to display, how to arrange them, and popular tags The font sizes of ordinary tags and simple tags can be set in the options of Simple Tags in the background.

Recommended tutorial: WordPress tutorial

The above is the detailed content of How to implement a colored tag cloud in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!