wp_tag_cloud( ‘smallest=1&largest=1&unit=em&number=18&orderby=count&order=DESC’ );
The problem is the “orderby=count” part. In the documentation it should be exactly like that but with PHP 8 on my server I get this warning:
Deprecated: uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in /www/htdocs/XXXXX/wp-includes/category-template.php on line 903
When I remove this part, it works fine. Is that a WordPress PHP 8 compatibility problem?
By the way, I use WordPress 5.9
]]>Category 1
tag cat1-1 tag cat1-2 tag cat1-3 tag cat1-4
But when I add duplicate code with other category id. Theme will display combine two categories tags. Like this:
Category 1
tag cat1-1 tag cat1-2 tag cat1-3 tag cat1-4 Category 2
tag cat1-1 tag cat1-2 tag cat1-3 tag cat1-4 tag cat2-1 tag cat2-2 tag cat2-3 tag cat2-4
So all I want is:
Category 1
tag cat1-1 tag cat1-2 tag cat1-3 tag cat1-4 Category 2
tag cat2-1 tag cat2-2 tag cat2-3 tag cat2-4
<h1>Category 2</h1>
<?php
$custom_query = new WP_Query('posts_per_page=-1&cat=1&order=DESC');
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) : $custom_query->the_post();
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$all_tags[] = $tag->term_id;
}
}
endwhile;
endif;
$tags_arr = array_unique($all_tags);
$tags_str = implode(",", $tags_arr);
$args = array(
'smallest' => 16,
'largest' => 16,
'unit' => 'px',
'number' => 0,
'format' => 'none',
'include' => $tags_str
);
wp_tag_cloud($args);
?>
<h1>Category 2</h1>
<?php
$custom_query = new WP_Query('posts_per_page=-1&cat=2&order=DESC');
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) : $custom_query->the_post();
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$all_tags[] = $tag->term_id;
}
}
endwhile;
endif;
$tags_arr = array_unique($all_tags);
$tags_str = implode(",", $tags_arr);
$args = array(
'smallest' => 16,
'largest' => 16,
'unit' => 'px',
'number' => 0,
'format' => 'none',
'include' => $tags_str
);
wp_tag_cloud($args);
?>
Thank you!
]]>The weird thing is when I hover over the tag link, I get a title attribute pop-up that displays how many post that tag shows up in, but then if I click on it, nothing.
Has anyone come across this before?
]]>This is the code:
<div class="boxes grid_7 metaboxes">
<h5>Tags populares</h5>
<p><?php wp_tag_cloud('number=50&smallest=10&largest=10&orderby=count&order=DESC'); ?></p>
</div>
However, on the home page, and only there, the output is:
<div class="boxes grid_7 metaboxes">
<h5>Tags populares</h5>
<p></p>
</div>
Home page: https://www.jogosdosaopaulo.com.br/
Example of page where it works: https://www.jogosdosaopaulo.com.br/gol-espirita-braganca-paulista/
(The cloud is at the bottom of the page.)
Does anyone have an idea of what can be causing this?
Thanks in advance for any help,
Alexandre
When I try to pass that page with the tag cloud through the is_user_logged_in function, I receive the following error, repeated for each tag from the tag cloud:
Warning: call_user_func(my_tag_text_callback) [function.call-user-func]: First argument is expected to be a valid callback in website.com/wp-includes/category-template.php on line 684
Line 684 of category-template.php is this:
$a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( call_user_func( $topic_count_text_callback, $real_count ) ) . "' style='font-size: " .
Anyone have any idea what’s going on here?
]]>Just to be clear, I’m working on a test site that has these seven tags:
– tag 1
– tag 2
– tag 3
– tag 4
– tag 5
– tag 6
– tag 7
When I limit the number of tags to 4, it always displays the same four tags in a random order. However, I want it to select four different tags from the complete list every time.
I think I’m looking for the ‘orderby’ parameter to have a ‘RAND’ value, but currently all I can assign to it is ‘name’ or ‘count.’ (Note – this is not the ‘order’ parameter.)
Here’s what I have now:
<?php if ( function_exists('wp_tag_cloud') ) : ?>
<?php wp_tag_cloud('smallest=10&largest=10&number=4&order=RAND'); ?>
<?php endif; ?>
Any help would be great!
]]>I’d like to get a category cloud for all direct sub-categories (only the next level) of the category (archive) that I’m viewing at the moment. Is this possible using the wp_tag_cloud function?
Thanks in advance,
René
Can this be done?
If not is there another way to call all the tags on the website?
]]>I’m trying to display a tag cloud with a tag being exluded.
Here is my code
<?php wp_tag_cloud( array('exclude' => 'Une') ); ?>
The tagcloud is displayed, but the tag specified isn’t excluded.
Any idea why ?
]]>https://www.ads-software.com/extend/plugins/opacity-tags/
]]>