• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

テンプレートタグ/wp tag cloud

提供: WordPress Codex 日本語版
< テンプレートタグ
2007年9月5日 (水) 20:12時点におけるBono (トーク | 投稿記録)による版 (en:Template Tags/wp_tag_cloud 2007年8月31日 (金) 15:01 MichaelH 版)

(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

テンプレート:stub


Note: This function is only available in WordPress 2.3 or newer.


Description

This template tag becomes available with WordPress Version 2.3. wp_tag_cloud displays a list of tags in what is called a 'tag cloud', where the size of each tag is determined by how many times that particular tag has been assigned to posts.

Usage

%%% <?php wp_tag_cloud(’’); ?>  %%%

Examples

Default Usage

$defaults = array('smallest' => 8, 'largest' => 22,
  'unit' => 'pt', 'number' => 45, 'format' => 'flat', 
  'orderby' => 'name', 'order' => 'ASC','exclude' => , 'include' => );

By default, the usage shows:

  • smallest - Use 8 point font-size when displaying the tag with lowest count value
  • largest - Use 22 point font-size when displaying the tag with highest count value
  • unit - Describes 'pt' (point) as the font-size unit for the smallest and largest values
  • number - Display at most 45 tags
  • format - Displays the tags in flat (separated by whitespace) style
  • orderby - Order the tags by name
  • order - Sort the tags in ASCENDING fashion
  • exclude - Exclude no tags
  • include - Include all tags

Cloud displayed under Popluar Tags title

<?php if ( function_exists('wp_tag_cloud') ) : ?>
<li>
<h2>Popular Tags</h2>
<ul>
<?php wp_tag_cloud('smallest=8&largest=22'); ?>
</ul>
</li>
<?php endif; ?>

Cloud limited in size and ordered by count rather than name

<?php wp_tag_cloud('smallest=8&largest=22&number=30&orderby=count'); ?>

Parameters

smallest 
(integer) The unit (font) size to use when displaying the tag with the smallest count value.
largest 
(integer) The unit (font) size to use when displaying the tag with the highest count value..
unit 
(string) Unit of measure as pertains to the smallest and largest values. Use pt for point.
number 
(integer) The number of actual tags to display in the cloud.
format 
(string) Format of the cloud display.
  • 'flat' (Default) tags are separated by whitespace
  • 'list' tags are in UL with a class='wp-tag-cloud'
  • 'array' tags are in an array
orderby 
(string) Order of the tags. Valid values:
  • 'name' (Default)
  • 'count'
order 
(string) Sort order. Valid values:
  • 'ASC' (Default)
  • 'DESC'
exclude 
(string) Comma separated list of tags to exclude. For example, 'exclude=ship,navy' means tags ship and navy will NOT be displayed. Defaults to exclude nothing.
include 
(string) Comma separated list of tags to include. For example, 'include=ship,navy' means tags, ship and nave, will be the only tags displayed. Defaults to include everything.

Related

テンプレートタグへの PHP 関数型パラメータの渡し方関数リファレンステンプレートタグ目次もご覧ください。