0

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?

2 Answers 2

1

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

$args = "separator"=>",";
wp_tag_cloud($args);
2
  • where would I enter that though?
    – Joe Bobby
    Commented Aug 19, 2012 at 2:57
  • @JoeBobby If I understand what you want to do, you can create your own wordpress widget
    – fdsa
    Commented Aug 19, 2012 at 22:29
0
 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');
1
  • it didnt work could you paste in a code block?
    – Joe Bobby
    Commented Aug 19, 2012 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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