Functions.php edit - by paulgor - on WordPress WooCommerce support

This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago ago by Olga Barlow

  • Avatar: paulgor
    paulgor
    Participant
    March 23, 2017 at 10:42

    Hi,
    try to add code

    //Register tag cloud filter callback
    add_filter('widget_tag_cloud_args', 'tag_widget_limit');
     
    //Limit number of tags inside widget
    function tag_widget_limit($args){
    
     //Check if taxonomy option inside widget is set to tags
     if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
      $args['number'] = 10; //Limit number of tags
     }
     
     return $args;
    }
    

    but widget limit don’t working
    Thanks

    Best,
    Paul

    Please, contact administrator
    for this information.
    2 Answers
    Avatar: paulgor
    paulgor
    Participant
    March 23, 2017 at 11:01

    try to edit class-wp-widget-tag-cloud.php

    		$tag_cloud = wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
    			'taxonomy' => $current_taxonomy,
    			'echo' => false,
                            'number' => 10
    		) ) );
    

    Now limit working, but it’s not very comfortably to edit this file after every wordpress update.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    March 24, 2017 at 13:39

    Hello,

    Try this code

    function filter_widget_tag_cloud_args( $array ) { 
        $array['number'] = 2;
        return $array; 
    }; 
    
    add_filter( 'widget_tag_cloud_args', 'filter_widget_tag_cloud_args', 10, 1 );

    But keep in mind that this is default WP widget and our theme does not have any settings for this.
    Our support does not include additional customization service. We provide support for XStore theme options and functions. Next time we won’t be able to provide support if your question is not related to theme functions.

    Regards

  • Viewing 3 results - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.