Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of realizing Color label Cloud by WordPress

Shulou Source: shulou.com Published: 2022-06-02 05:07:48 10月01日 Update

This article is about how WordPress implements a color tag cloud. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

How to realize Color label Cloud by WordPress

Color tag cloud we can see this effect on many websites, here is to achieve wordpress to add color tag cloud effect.

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

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

Function getColorByScale ($scale_color, $min_color, $max_color)

two。 Comment out (or delete) the following statement in the function getColorByScale:

$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)

3. Add the following code:

/ / Colorful Tag Cloud start $r = dechex (rand (0255)); $g = dechex (rand (0196)); $b = dechex (rand (0255))

Colorful Tag Cloud end as to how many tags to display, how to arrange them, and how many fonts popular tags and normal tags are, you can set them in the options of Simple Tags in the background.

Thank you for reading! On WordPress to achieve color label cloud method to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Tags: Tags colors effects methods code content more good practical ordinary popular can be passed background size font articles comments see knowledge articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information MySQL OPPO Reno Apple