Support » Plugins » Bug in tag clouds?

  • I’m trying to hack around with WP 2.3 to add support for its tags to my theme (I previously used UTW). I want a dropdown menu of all tags, sorted alphabetically.

    It seems that I should be able to use wp_tag_cloud(‘format=array’) to build on, but this echos the array, it does not return it, making it impossible to manipulate, or even display properly.

    I’ve been doing some messing around with a tweaked version of this function, but have not succeeded in returning a usable array.

    thanks in advance for any advice.

Viewing 4 replies - 1 through 4 (of 4 total)
  • bump

    I’ve tried also format=array trying to help you out with the problem …it is correct: It just returns “array” text not the tags.

    This seems to be still relevant, so here is the solution:

    in wp-includes/category-template.php the function wp_tag_cloud echos the return value, which makes sense if it’s a HTML string but not if it’s an array.

    So if you replace

    if ( is_wp_error( $return ) )
    		return false;
    	else
    		echo apply_filters( 'wp_tag_cloud', $return, $args );

    with

    if ( is_wp_error( $return ) )
    		return false;
    	else if (is_array($return)) {
    	 return $return;
    	} else {
    		echo apply_filters( 'wp_tag_cloud', $return, $args );
    	}
    }

    (line 234ff) to check if the return value is an array then the array-option works.

    Known issue:
    http://trac.wordpress.org/ticket/5155

    A patch is in that ticket to fix the problem. Hopefully it’ll make it into 2.5.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Bug in tag clouds?’ is closed to new replies.