ワードプレス、タグクラウドのカスタマイズ

ワードプレス
スポンサーリンク

むーん?
何のために入力したのか?

タグクラウドの件数のカッコを取り除くだったかな?

functions.php
//タグクラウドの出力変更
function wp_tag_cloud_custom_ex($output) {
    //style属性を取り除く
    $output = preg_replace('/\s*?style="[^"]+?"/i', '', $output);
    //カッコを取り除く
    $output = str_replace(' (', '', $output);
    $output = str_replace(')', '', $output);
    return $output;
}
add_filter('wp_tag_cloud', 'wp_tag_cloud_custom_ex');

次が、

functions.php
//タグクラウドのカスタマイズ
function tag_cloud_customize($args) {
    $myargs = array(
        'smallest' => 1.0, //最小フォントサイズ
        'largest' => 1.0, //最大フォントサイズ
        'unit' => 'em', //フォントサイズ単位
        'orderby' => 'count', //表示順(件数)
        'order' => 'DESC' //ソート順(降順)
    );
    $args   = wp_parse_args($args, $myargs);
    return $args;
}
add_filter('widget_tag_cloud_args', 'tag_cloud_customize');

文字の大きさを統一したいときに書き込む。

 

スポンサーリンク

関連記事一覧

  1. この記事へのコメントはありません。

CAPTCHA


日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)