Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Using <?php wp_tag_cloud(''); ?> to display tags on my website, how do I separate each tag with a comma but also remove the comma from the last tag?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

According to the Wordpress Codex on tag clouds, you need to specify a comma as the "separator" argument.

$args = "separator"=>",";
wp_tag_cloud($args);
share|improve this answer
    
where would I enter that though? –  Joe Bobby Aug 19 '12 at 2:57
    
@JoeBobby If I understand what you want to do, you can create your own wordpress widget –  fdsa Aug 19 '12 at 22:29
 Filter the seperator arg for the tag cloud function. Put the following in your theme's functions.php

/**
 * Filter arguments of tag cloud widget to enlarge our text and
 * add commas
 */
function myfunc_filter_tag_cloud($args) {
    $args['smallest'] = 18;
    $args['largest'] = 32;
    $args['unit'] = 'px';
    $args['separator']= ', ';
    return $args;
}
add_filter ( 'widget_tag_cloud_args', 'myfunc_filter_tag_cloud');
share|improve this answer
    
it didnt work could you paste in a code block? –  Joe Bobby Aug 19 '12 at 2:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.