WordPressでタグクラウドの並び順とフォントサイズを変更

fute / 10月 17th, 2008/ Posted in WP設定 / No Comments »

Office L ? [WPCH vol.01] ウィジェットをハック。タグクラウドのソート順を変更する

http://officel.biz/wordpress/wordpress-core-hacks-vol01.htm


弄る前にバックアップを忘れぬこと(‘A`)b


wp-includes/widgets.phpを変更するらしい



// 1340行目付近



function wp_widget_tag_cloud($args) {

extract($args);

$options = get_option(‘widget_tag_cloud’);

$title = empty($options['title']) ? __(‘Tags’) : $options['title'];



echo $before_widget;

echo $before_title . $title . $after_title;

// wp_tag_cloud 並び順変更(デフォルトは名前の昇順。カウントの降順にする)

// wp_tag_cloud(); // この行をコメントし、下のようにする

wp_tag_cloud(array(‘orderby’ => ‘count’, ‘order’ => ‘DESC’));

echo $after_widget;

}



これで並び順が使用頻度順になる




今度はフォントサイズとかの変更

wp-includes/category-template.phpを変更


’smallest’ => 8

‘largest’ => 22


まぁこのへんを適当にいじる

残りの設定(ソートキーとか出力先)はリンク先を参照されたし

 
このエントリーをはてなブックマークに追加


Tags: WP設定, タグクラウド

Leave a Reply

Name required

Mail (will not be published) required

Website