Skip to content
Public Ticket #17952

widget_tag_cloud_args does not work with tag cloud in sidebar

Conversation thread

PenciDesign Supporter replied

Staff Reply

Hi,

Thank you for let me know about this.

Have a good day.

Regards,
PenciDesign.


xScorpionx replied

Customer Reply

I have already solved it and I have seen what the problem was. I have started using soledad theme with the wordpress version 5.8. This version of wordpress uses gutenberg blocks instead of the old widgets. That is why the filter was not working, since I was using a block. To solve I have returned to the old widgets with the following filter:

add_filter( 'use_widgets_block_editor', '__return_false' );

Then I have selected the old tag widget, and I have gone back to the new version with Gutenberg blocks, but now I have the inherited widget that I have selected from the old widgets and on which the filter works. I don't know if gutenberg blocks have their own filters, but at least the tag filter doesn't work with the block.

Thank you very much for your quick responses, a good support is as important as a good product.


PenciDesign Supporter replied

Staff Reply

Hi,

The code working properly on my site. Please try to check again.

function custom_tag_cloud_widget() {
    $args = array(
        'smallest' => 8,         'largest' => 22,         'unit' => 'pt',         'number' => 15,
        'format' => 'flat',         'separator' => "<br>",         'orderby' => 'name',         'order' => 'ASC',
        'exclude' => '',         'include' => '',         'link' => 'view',         'taxonomy' => 'post_tag',         'post_type' => '',         'echo' => true
    );
    return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

Regards,
PenciDesign.

xScorpionx replied

Customer Reply

I think you can replicate it in your web staging environment. It is only to use the following code:

<code>

add_filter( 'widget_tag_cloud_args', 'wp_tag_cloudweb' );

function wp_tag_cloudweb() {
$args = array(
    'smallest'                  => 13,

    'largest'                   => 13,
    'unit'                      => 'px',

    'number'                    => 10,  
    'format'                    => 'flat',
    'separator'                 => " — ",
    'orderby'                   => 'count',

    'order'                     => 'DESC',
    'show_count'                => 1,
    'echo'                      => false
);
        return $args;
 
}

</code>

The code as you see is correct, but it does not work when I add the tag cloud widget in any sidebar space. I've tried adding the code as a plugin, it doesn't work either, I've tried to change the priority and it doesn't work either. Has the filter in the theme been modified?

PenciDesign Supporter replied

Staff Reply

Hi,

Please send me your site login credential in a PRIVATE reply. I'll log in and help you check your code.

Regards,
PenciDesign.


xScorpionx replied

Customer Reply

Yes, I know. I did it from code snippets and the code does not work from there.

I tried the code in another theme and it works, but in soledad theme it doesn't work

PenciDesign Supporter replied

Staff Reply

Hi,

By default, all the text field on Customizer doesn't support execute PHP code. Please install the Code Snippet plugin, the create a new snippet with your custom PHP code.

Regards,
PenciDesign.


xScorpionx replied

Customer Reply

I just deleted that line, but it doesn't work. >span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="es" data-phrase-index="2">Besides in the hook I have to be ordered from most popular to least, etc, show count. I put it in to see if it worked, but none of that changes. I don't think it's a css problem.

PenciDesign Supporter replied

Staff Reply

Hi,

Please go to Appearance → Theme Editor:

- Select theme to edit: Soledad,

- Select file main.css, find:

.widget .tagcloud a {
    text-transform: uppercase;
    background: #ffffff;
    color: #999999;
    padding: 6px 12px 5px;
    margin-right: 5px;
    margin-bottom: 8px;
    display: inline-block;
    font-size: 11px !important;
    background: none;
    border: 1px solid #DEDEDE;
    transition: all 0.3s;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    outline: none;
    font-weight: normal;
    line-height: 1.2;
}
Delete this line on the code above:
font-size: 11px !important;

image.png

Regards,
PenciDesign.


xScorpionx replied

Customer Reply

In console I do not see any error.

PenciDesign Supporter replied

Staff Reply

Hi,

Please send me your site URL.

Regards,
PenciDesign.


xScorpionx started the conversation

Conversation Start

I have used the following code: 

add_filter( 'widget_tag_cloud_args', 'wp_tag_cloudweb' );

function wp_tag_cloudweb() {

$args = array(
    'smallest'                  => 13,     'largest'                   => 13,
    'unit'                      => 'px',     'number'                    => 10,  
    'format'                    => 'flat',
    'separator'                 => " — ",
    'orderby'                   => 'count',     'order'                     => 'DESC',
    'show_count'                => 1,
    'echo'                      => false
);
        return $args;
 
}


But nothing changes in tag cloud widget, I have tried another theme and the hook works. I put it in Header Signup form widget space.

Want to join this conversation or access attachments? Sign in first.