Written by Anonymous
function wp_tag_cloud_custom( $output, $args ) { //style属性を取り除く $output = preg_replace( '/\s*?style="[^"]+?"/i', '', $output); //タグテキストにspanタグの取り付け $output = preg_replace( '/ aria-label="([^"]+?)">/i', ' aria-label="$1"><span class="tag-caption"><span class="fa fa-tag" aria-hidden="true"></span> ', $output); //数字を表示しているとき if (isset($args['show_count']) && $args['show_count']) { $output = str_replace( '<span class="tag-link-count">', '</span><span class="tag-link-count">', $output); } else {//数字を表示しないとき $output = str_replace( '</a>', '</span></a>', $output); } return $output; } function widget_tag_cloud_args_custom($args) { $defaults = array( 'orderby' => 'count', //使用頻度順 'order' => 'DESC', // 降順(使用頻度の高い順) 'number' => 60, // 表示数 'format' => 'list', ); $args = wp_parse_args($args, $defaults); return $args; }