Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2866108
widget_tag_cloud_args does not work with tag cloud in sidebar
Closed

Comments

  • xScorpionx started the conversation

    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.

  •  2,492
    PenciDesign replied

    Hi,

    Please send me your site URL.

    Regards,
    PenciDesign.


  •   xScorpionx replied privately
  • xScorpionx replied

    In console I do not see any error.

  •  2,492
    PenciDesign replied

    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

    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.

  •  2,492
    PenciDesign replied

    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

    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

  •  2,492
    PenciDesign replied

    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

    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?

  •  2,492
    PenciDesign replied

    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

    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.


  •  2,492
    PenciDesign replied

    Hi,

    Thank you for let me know about this.

    Have a good day.

    Regards,
    PenciDesign.