ThemeShaper Forums » Thematic

[closed]

Change Tag Cloud argument values using hook

(4 posts)
  • Started 8 years ago by jdcohan
  • Latest reply from Shed
  • This topic is not resolved
  1. jdcohan
    Member

    (I appreciate this isn't solely a Thematic-specific inquiry.)

    Suppose I want the 'largest' size for the wp_tag_cloud() function to be something other than the default.

    How would I do this without modifying defaults in the wp_tag_cloud() function in category_template.php?

    I figure I can add a little code to my child theme's functions.php. (I've done several simple add_action() mods, but this has me puzzled.

    Do I add_filter()? add_action()? apply_filters()?

    And how?

    TIA,
    Jeff

    Posted 8 years ago #
  2. i'm only of limited help, and no real examples, just maybe some general direction.

    I saw your post on the older thread regarding this. I think by finding the tag cloud function they mentioned inside of wp-includes, then digging into the WP codex on filters, you should be able to use add_filter to that tag cloud function to bend it to your will.
    Something loosely like:

    function my_tag cloud() {
    
    //all the tag cloud code, changed to suit my purpose
    
    }
    
    add_filter('the_tag_cloud_hook', 'my_tag_cloud');
    Posted 8 years ago #
  3. Rab Austen
    Member

    Jeff,

    I've posted a working example on your wordpress.org thread

    http://wordpress.org/support/topic/change-wp_tag_cloud-argument-values-using-hook?replies=2#post-1667516

    It seems overkill for just a few tweaks to an array but it works for me.

    Cheers
    Rab

    Posted 8 years ago #
  4. Hi

    I know this is an old topic and not really Thematic related, but I hope this is of help to anyone searching for an answer to customizing the tag cloud results.

    Without messing with the core Wordpress files, just add a function like the following...

    add_filter( 'widget_tag_cloud_args', 'my_widget_tag_cloud_args' );
    	function my_widget_tag_cloud_args( $args ) {
    	$args['number'] = 40;
            $args['exclude'] = 161;
    	return $args;
    }

    A list of parameters can be found at http://codex.wordpress.org/Function_Reference/wp_tag_cloud

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.