- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「関数リファレンス/wp star rating」の版間の差分
(英語版をコピペ) |
細 (各章のヘッダーを和訳して <div> タグ埋め込み。) |
||
1行目: | 1行目: | ||
{{Stub}} | {{Stub}} | ||
− | = | + | <div id="Description"> |
+ | == 説明 == | ||
+ | </div> | ||
Outputs a HTML element with the star rating exposed on a 0-5 scale in half star increments (i.e. 1, 1.5, 2 stars). Optionally, if specified, the number of ratings may also be displayed in the title attribute by passing the <tt>$number</tt> parameter. | Outputs a HTML element with the star rating exposed on a 0-5 scale in half star increments (i.e. 1, 1.5, 2 stars). Optionally, if specified, the number of ratings may also be displayed in the title attribute by passing the <tt>$number</tt> parameter. | ||
By default, only works in admin screens. | By default, only works in admin screens. | ||
− | = | + | <div id="Usage"> |
− | + | == 使用法 == | |
− | = | + | </div> |
+ | <?php wp_star_rating( $args ); ?> | ||
+ | |||
+ | <div id="Parameters"> | ||
+ | == パラメーター == | ||
+ | </div> | ||
{{Parameter|$args|array|array of arguments|optional|0 stars}} | {{Parameter|$args|array|array of arguments|optional|0 stars}} | ||
− | === | + | |
+ | <div id="Arguments"> | ||
+ | === 引数 === | ||
+ | </div> | ||
*'''rating''' - The numeric rating value 0-5 in 0.5 increments. (or 0-100 percent rating for percent type calls) Default 0. | *'''rating''' - The numeric rating value 0-5 in 0.5 increments. (or 0-100 percent rating for percent type calls) Default 0. | ||
*'''type''' - Acceptable values are 'percent' or the default 'rating'. | *'''type''' - Acceptable values are 'percent' or the default 'rating'. | ||
*'''number''' - Quantity of submitted ratings, displays as part of title attribute text on hover. | *'''number''' - Quantity of submitted ratings, displays as part of title attribute text on hover. | ||
− | = | + | <div id="Return Values"> |
+ | == 戻り値 == | ||
+ | </div> | ||
{{Return||none|directly echoes content}} | {{Return||none|directly echoes content}} | ||
36行目: | 48行目: | ||
</pre> | </pre> | ||
− | = | + | <div id="Notes"> |
+ | == 注 == | ||
+ | </div> | ||
In order to use this function on the front end, your template must include the <tt>wp-admin/includes/template.php</tt> file and enqueue the appropriate dashicons CSS font information. Example CSS: | In order to use this function on the front end, your template must include the <tt>wp-admin/includes/template.php</tt> file and enqueue the appropriate dashicons CSS font information. Example CSS: | ||
84行目: | 98行目: | ||
Note the font data in the above CSS has been omitted for clarity. This data must be included in working code. Refer to <tt>wp-admin/css/dashicons.css</tt> | Note the font data in the above CSS has been omitted for clarity. This data must be included in working code. Refer to <tt>wp-admin/css/dashicons.css</tt> | ||
− | = | + | <div id="Change Log"> |
− | + | == 改訂履歴 == | |
+ | </div> | ||
+ | [[Version 3.8]] にて導入されました。 | ||
− | = | + | <div id="Source File"> |
− | <tt>wp_star_rating()</tt> | + | == ソースファイル == |
+ | </div> | ||
+ | <tt>wp_star_rating()</tt> は {{Trac|wp-admin/includes/template.php}} にあります。 | ||
− | = | + | <div id="Related"> |
+ | == 関連項目 == | ||
+ | </div> | ||
| | ||
− | |||
{{原文|wp_star_rating|140793}}<!-- 19:31, January 26, 2014 Djkaz 版 --> | {{原文|wp_star_rating|140793}}<!-- 19:31, January 26, 2014 Djkaz 版 --> | ||
− | |||
{{Tag Footer}} | {{Tag Footer}} | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:New_page_created]] | [[Category:New_page_created]] |
2014年1月26日 (日) 20:27時点における版
Outputs a HTML element with the star rating exposed on a 0-5 scale in half star increments (i.e. 1, 1.5, 2 stars). Optionally, if specified, the number of ratings may also be displayed in the title attribute by passing the $number parameter.
By default, only works in admin screens.
使用法
<?php wp_star_rating( $args ); ?>
パラメーター
- $args
- (array) (optional) array of arguments
- 初期値: 0 stars
引数
- rating - The numeric rating value 0-5 in 0.5 increments. (or 0-100 percent rating for percent type calls) Default 0.
- type - Acceptable values are 'percent' or the default 'rating'.
- number - Quantity of submitted ratings, displays as part of title attribute text on hover.
戻り値
- (none)
- directly echoes content
Results in a star rating like this:
Examples
<? php $args = array( 'rating' => 3.5, 'type' => 'rating', 'number' => 1234, ); wp_star_rating( $args ); ?>
The above code outputs the following HTML:
<div class="star-rating" title="3.5 rating based on 1,234 ratings"><div class="star star-full"></div><div class="star star-full"></div><div class="star star-full"></div><div class="star star-half"></div><div class="star star-empty"></div></div>
注
In order to use this function on the front end, your template must include the wp-admin/includes/template.php file and enqueue the appropriate dashicons CSS font information. Example CSS:
@font-face { font-family: "dashicons"; src: url("../fonts/dashicons.eot"); } @font-face { font-family: "dashicons"; src: url(data:application/x-font-woff;charset=utf-8;base64,/* !! Large amount of data removed, see wp-includes/css/dashicons.css for complete data !! */) format("woff"), url("../fonts/dashicons.ttf") format("truetype"), url("../fonts/dashicons.svg#dashicons") format("svg"); font-weight: normal; font-style: normal; } .star-rating .star-full:before { content: "\f155"; } .star-rating .star-half:before { content: "\f459"; } .star-rating .star-empty:before { content: "\f154"; } .star-rating .star { color: #0074A2; display: inline-block; font-family: dashicons; font-size: 20px; font-style: normal; font-weight: 400; height: 20px; line-height: 1; text-align: center; text-decoration: inherit; vertical-align: top; width: 20px; }
Note the font data in the above CSS has been omitted for clarity. This data must be included in working code. Refer to wp-admin/css/dashicons.css
改訂履歴
Version 3.8 にて導入されました。
ソースファイル
wp_star_rating() は wp-admin/includes/template.php
にあります。
関連項目
最新英語版: WordPress Codex » wp_star_rating (最新版との差分)