WordPress how to make a category cloud. Making a beautiful cloud of tags (tags) in WordPress. Best Tag Cloud Plugin for WordPress

We all know that tags are an important part of WordPress taxonomies and they serve as a tool for organizing them. Tags are created on the fly during the post creation process and help us find similar posts that are related by certain tags. Typically, on a WordPress blog, various tags are grouped within a tag cloud, and the size of each tag is determined by how often it is used in posts. In this article we will tell you how to use the function correctly wp_tag_cloud(), which is responsible for all these tag clouds.

Introduction

This is the core built-in feature for displaying the tags assigned to your posts, which displays a tag cloud.

8, "largest" => 22, "unit" => "pt", "number" => 45, "format" => "flat", "separator" => "\n", "orderby" => " name", "order" => "ASC", "exclude" => null, "include" => null, "topic_count_text_callback" => default_topic_count_text, "link" => "view", "taxonomy" => "post_tag" , "echo" => true); ?>

WordPress Codex page wp_tag_cloud() clearly explains all these function parameters, but still let's quickly look at the most basic ones.

  • 'smallest'– This setting specifies the minimum text size in the tag cloud.
  • 'largest'– This setting determines the maximum text size in the tag cloud.
  • 'number'– This setting determines the total number of tags displayed in the tag cloud. You can specify '0' if you want all entries to be entered.
  • 'format'– This parameter determines the cloud display format. It can take the values ​​‘ flat‘, ‘list', or ' array
  • 'separator'– This parameter defines the tag delimiter in the cloud
  • 'topic_count_text_callback'– This option displays the number of entries assigned to each tag as a tooltip
  • 'taxonomy'– This setting determines the type of WordPress taxonomy that can be used in the tag cloud. The default value is ‘ post_tags‘, but you can use custom taxonomies as well

These parameters play a key role in customizing the tag cloud.

Usage

WordPress has a standard Tag Cloud widget that can be placed in the appropriate area of ​​the page. However, even without using a widget you can use the function wp_tag_cloud() to display and configure a tag cloud on your blog. You can also specify parameters in a variety of ways.

The parameters are separated by '&' on one simple line.

Specifying parameters in array format.

"10" , "largest" => "50", "unit" => "px", "number" => "45", "separator" => ":: ", "orderby" => "count", "order" => "RAND")); ?>

We indicate only the selected parameters, leaving the rest as they are by default.

We return the tag cloud as an array without displaying it on the blog. The result can be used later in PHP code.

Practical examples

Example 1: Display a tag cloud in the sidebar or footer of your theme

Create a function in your file functions.php and return the function wp_tag_cloud(). Once it is defined, you can call this function anywhere on your blog.

Function my_cloud($echo = false) ( if (function_exists("wp_tag_cloud")) return wp_tag_cloud(); )

Now let's open your file sidebar.php and call the function to display the tag cloud.

Popular tags"; my_cloud(); ?>

Let's add some CSS styling to our file style.css to make the tag cloud look more decent.

Mycloud a ( background: #FFC414; color: #0000FF; display: inline-block; margin: 0 4px 8px 0; padding: 2px 10px; -webkit-border-radius: 20px; -moz-border-radius: 20px; border -radius: 20px; font-size: 10px; ) .mycloud h3 ( font-style: italic; font-weight: bold; font-size: 30px; color: #FF00FF; font-family: Comic Sans; )

This is what it looks like now:

We also do the same in footer.php your topic.

You can make it even more beautiful if you add your own CSS styles.

By adding various parameters to the function wp_tag_cloud() to file functions.php we can customize our tag cloud. For example, if you want to include both tags and categories in a tag cloud, or taxonomy cloud, then the function should be written as follows:

Wp_tag_cloud(array("taxonomy" => array("post_tag","category")));

Example 2: Creating a tag cloud page for your blog

Sometimes you simply don’t need to place the cloud of tags in the sidebar or footer, but you need to create a separate page for them in order to “clean” the appearance of the blog. You can do this in the following way.

First, let's create our own page template in your theme folder with the function wp_tag_cloud(). Let's call this file tagcloud.php.

Now you need to log into the WordPress admin area and go to Pages -> Add new. Set the desired title to the page, and then in the section Page Attributes select a template for it - Tag Cloud, then click Update. That's all. Your tag cloud page is ready. You can “colorize” it using CSS.

Example 3: Creating a Scrollable Tag Cloud Block for a Sidebar

You can invite users to select tags in the sidebar from a scrollable block. To do this you need to create a function in the file functions.php.

Function cloudbox () ( if (function_exists("wp_tag_cloud")) ( $tags = wp_tag_cloud(array("smallest"=>10, "largest"=>10, "orderby"=>"name", "order"=> "ASC", "format" => "array")); foreach($tags as $tag) ( echo $tag."
"; } } }

In the function above we have used the function array format wp_tag_cloud(), the font was left the same as it was, and the list was sorted by name in descending order.

Now let's open ours sidebar.php and call this function.

Please select a tag

Let's style it using CSS.

#cloud ( background: #FFFFCC; height: 200px; width: 200px; margin: 0 auto; overflow: scroll; border: 4px solid #000000; padding: 2px; text-align: justify; ) #cloud a ( background: # 400000; color: #FFFF00; margin: 0 4px 8px 0; -webkit-border-radius: 20px; -size: 15px; ) #text ( font-style: italic; font-weight: bold; font-size: 20px; color: #FF9900; font-family: Comic Sans; )

As a result, the block will look like this.

A huge number of websites are created on the WordPress engine, and it is used by both beginners and professionals.

CMS has many advantages, one of them is a huge selection of different plugins with which you can transform the appearance of the site. Thanks to extensions, you can install a lot of interesting widgets, including a cloud of tags (categories).

How to make a tag cloud for WordPress? This engine has a standard plugin to install a beautiful form with floating tags.

To use it, you must have tags written for each page; if you have not done this before, you will have to start with this, but adding tags is not difficult.

Best Tag Cloud Plugin for WordPress

There are many different extensions in the standard set, however, they are not always of high quality and often place a high load on the server.

To optimize your site, we have already told you how to add . Installing a tag cloud without extensions is too difficult, and the best solution is the WP-Cumulus plugin.

Download and install the add-on, after which a new item will appear in the main menu of the administrative panel so that you can set the settings. There are not many of them, but everything you need is here:

You don’t have to specify the title; set the size so that the block fits nicely into the template; the same goes for the background color. It is better to leave the rotation speed at default. note that You can display tags and categories in the cloud, this is the main advantage of the WP-Cumulus plugin.

After setting the parameters, add a tag cloud to any area (sidebar is ideal), you should get something like this:

The usual format in which all categories and tags are presented. You will spend just a few minutes to install the same block on your website.

Alternative tag cloud plugins for WordPress

Naturally, WP-Cumulus has a lot of analogues, so you can easily solve the problem if for some reason this extension does not suit you. New plugins appear all the time; let’s consider only those that have been used by thousands of website owners for a long time.

Tags are another functional element in the WordPress engine, which is used along with categories and the search bar. Thanks to them, you can improve behavioral factors on your web project, allowing the reader to search for similar publications using relevant words.

Often, the display of labels is already implemented in the design theme (at the end of each post), but in addition, you can use third-party plugins like “ ”, which create an original “label cloud” format. Or use the existing standard widget from the WordPress set, which will easily fit into any template design.

Label cloud

The standard “Tag Cloud” widget is located in the admin panel in the “Appearance” - “Widgets” section, and is installed like all other widgets (by dragging it into the active Sidebar or through the context menu).
Unlike third-party solutions, the “tag cloud” has minimal settings, prompting the webmaster to set a name for the title and mark the taxonomy output (in addition to tags, categories and custom data types will be shown).

The widget code itself, more precisely its “wp_tag_cloud” function, is located in the base WordPress directories (wp-includes), so editing the source is not recommended. But we can use another way to fine-tune the widget.

Tag Cloud settings

To make changes, you can create a separate function indicating the required parameters for a standard widget, or , and place a “label cloud” through a text widget.

I liked the method through the “Text” widget more, and my version took the following code:

Now in more detail about the function parameters that can be used to display labels:

  • smallest – minimum font size for less popular publications;
  • largest – maximum font size for the most popular publications;
  • unit – unit of measurement for font size, can take the following values: pt, px, %;
  • number – number of labels to display (default 45);
  • format – format for displaying links: flat (separated by a space – by default), list – UL list, array – like an array for PHP;
  • separator – value of the separator between labels (default – space);
  • orderby – sorting settings: name – alphabetically (default), count – by quantity;
  • order – sort order: ascending – ASC (default), descending – DESC, random – RAND;
  • exclude – tags that should be excluded from display;
  • include – labels that must be displayed.

Instead of an afterword

Thus, by editing the PHP code in the text widget, you can achieve the desired appearance for the “label cloud”. Now knowing the parameters, we see that the example I gave will display 30 labels with a font size of 9pt - 16pt, and sort them alphabetically (by name).

However, it is very simple and does not always satisfy the design and functionality requirements. In this article, you will learn about a plugin that allows you to create a more beautiful and convenient label cloud, but at the same time it is just as simple and lightweight.

Cool Tag Cloud Plugin: WordPress Tag Cloud

The Cool Tag Cloud plugin creates an easily customizable tag cloud widget that is visually appealing and easy to customize and use. There is a complete Russian translation, so there are no difficulties with it.

The label cloud is an additional navigation tool that helps site visitors better navigate and imagine what topics this project covers. This element is useful for behavioral factors.

To create a WordPress tag cloud, download the Cool Tag Cloud plugin from the link below. Install it and activate it.

After the settings, the label cloud may look like this.

WordPress Cool Tag Cloud

The plugin does not have its own settings, so we immediately go to the “Appearance” console item and the “Widgets” subitem. Select the “Cool Tag Cloud” widget, drag it to the desired sidebar and expand it for settings.

All options are in Russian. I won’t even tell you what is needed for what.

Just a list of the features of this plugin:

  • Flexible font settings: family, style and size. You can set the minimum font size for tags, and the maximum for tags with more and less entries.
  • 10 color options make this WordPress label cloud suitable for any design.
  • Orientation to the left or right, thanks to which you can harmoniously place the cloud in both the left and right sidebar.
  • Simple and easy hover animation.
  • Ability to set the maximum number of labels displayed in the widget.
  • The ability to display categories instead of tags, as well as other taxonomies on the site, if available.
  • Displays the number of entries in a label on hover.
  • Possibility to include the attribute so that tags are not indexed.

In this article, I will introduce you to three ways to display a tag cloud on a blog. Each withdrawal method has its own advantages. Let's look at each method separately.

1st method. Outputting a label cloud using php code
Advantage: The label cloud can be displayed anywhere.

By the way, recently, this method helped me out a lot on one of my sites, since I needed to set my own style for the header and the labels themselves.
Disadvantage: you need to be able to work with codes. Unfortunately, not everyone likes or even knows how to correct something in files.
Here's the code itself:

Tag cloud:

You paste the code anywhere in your theme (template) file.

Extra options :

○ “smallest” parameter – determines the font size of the tag with the least popularity.

○ “largest” parameter – determines the font size of the tag with the most popularity.

We combine two parameters “smallest” and “largest”:

○ “number” parameter – determines the number of tags shown on the page

○ “orderby” parameter – sorts tags by name (name) and by popularity (count)

Or

○ “order” parameter – displays the tag cloud in alphabetical order – ASC(A-Z), DESC(Z-A) and RAND (random output order).

○ “exclude” parameter – will help exclude unnecessary tags from the general list. Enter tag IDs separated by commas.

○ “include” parameter – will help you specify which tags to display in the general list. Enter tag IDs separated by commas.

2nd method

Advantages: it's fast.
Disadvantages: there are restrictions in the settings, and it’s not always possible to design it the way you want.
So go to admin panel => “Appearance” => “Widgets”. On the left, find the Tag Cloud widget. Click on it

and select an available location to insert the widget.

3rd method. Outputting a tag cloud via the “wp-cumulus” or “Tag Cloud Canvas” plugin
“WP-Cumulus” or “Tag Cloud Canvas” is a plugin for creating a 3D tag cloud in WordPress and after installation the tag cloud looks like this:

You can download the “WP-Cumulus” plugin and see how it is configured at this address:

https://mywordpress.ru/plugins/wp-cumulus-oblako-tegov/

Download the “Tag Cloud Canvas” plugin:

https://wordpress.org/plugins/tag-cloud-canvas/

Advantages: beautiful and fast output of the label cloud.
Disadvantages: does not always fit the blog design, and also an extra load on the blog.

That's all, friends! I wish you to make the right and successful choice!



2024 wisemotors.ru. How it works. Iron. Mining. Cryptocurrency.