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

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

「テンプレートタグ/get the post thumbnail」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Template Tags/get_the_post_thumbnail 17:35, 6 January 2010 Ramiy 版を翻訳用にコピー)
 
(整形、試験的にテンプレートタグガイドを挿入/未翻訳)
1行目: 1行目:
== Description ==
+
{{NeedTrans}}
 +
{{テンプレートタグガイド|PHP}}
 +
== Description ==<!-- Description -->
  
 
Gets Post Thumbnail as set in post's or page's edit screen. Thumbnail images are given class "attachment-thumbnail"
 
Gets Post Thumbnail as set in post's or page's edit screen. Thumbnail images are given class "attachment-thumbnail"
  
== Usage ==
+
== Usage ==<!-- Usage -->
  
%%% <?php echo get_the_post_thumbnail( $id, $size, $attr ); ?> %%%
+
<?php echo get_the_post_thumbnail( $id, $size, $attr ); ?>
  
== Parameters ==
+
== Parameters ==<!-- Parameters -->
  
 
{{Parameter|$id|int|Post ID.|Required}}
 
{{Parameter|$id|int|Post ID.|Required}}
13行目: 15行目:
 
{{Parameter|$attr|int||Optional}}
 
{{Parameter|$attr|int||Optional}}
  
== Examples ==
+
== Examples ==<!-- Examples -->
  
=== Sample Usage ===
+
=== Sample Usage ===<!-- Sample Usage -->
  
%%%<?php $pages = get_pages(array('child_of' => 1)); ?>  
+
<pre>
 +
<?php $pages = get_pages(array('child_of' => 1)); ?>  
 
<ul>
 
<ul>
 
<?php foreach ($pages as $page): ?>
 
<?php foreach ($pages as $page): ?>
26行目: 29行目:
 
</li>
 
</li>
 
<?php endforeach; ?>
 
<?php endforeach; ?>
</ul>%%%
+
</ul>
 +
</pre>
  
=== More Options ===
+
=== More Options ===<!-- More Options -->
  
 
  get_the_post_thumbnail($id);                  // without parameter -> Thumbnail
 
  get_the_post_thumbnail($id);                  // without parameter -> Thumbnail
38行目: 42行目:
 
  get_the_post_thumbnail($id, array(100,100) ); // Other resolutions
 
  get_the_post_thumbnail($id, array(100,100) ); // Other resolutions
  
== Notes ==
+
== Notes ==<!-- Notes -->
  
 
To enable post thumbnails, the current theme must include <code>add_theme_support( 'post-thumbnails' );</code> in its <tt>functions.php</tt> file.
 
To enable post thumbnails, the current theme must include <code>add_theme_support( 'post-thumbnails' );</code> in its <tt>functions.php</tt> file.
  
== Change Log  ==
+
== 変更履歴 ==
  
Since: 2.9.0
+
* [[Version 2.9|2.9]] : 新規テンプレートタグ
  
== Source File ==
+
== Source File ==<!-- Source File -->
  
 
<tt>get_the_post_thumbnail()</tt> is located in {{Trac|wp-includes/post-thumbnail-template.php}}.
 
<tt>get_the_post_thumbnail()</tt> is located in {{Trac|wp-includes/post-thumbnail-template.php}}.
  
== External Resources ==
+
== External Resources ==<!-- External Resources -->
  
 
* [http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature Everything you need to know about WordPress 2.9’s post image feature], by JustintAdlock.com
 
* [http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature Everything you need to know about WordPress 2.9’s post image feature], by JustintAdlock.com
57行目: 61行目:
 
{{原文|Template Tags/get_the_post_thumbnail|81834}}<!-- 17:35, 6 January 2010 Ramiy 版 -->
 
{{原文|Template Tags/get_the_post_thumbnail|81834}}<!-- 17:35, 6 January 2010 Ramiy 版 -->
  
== Related ==
+
== Related ==<!-- Related -->
  
 
{{Post Thumbnail Tags}}
 
{{Post Thumbnail Tags}}
63行目: 67行目:
 
{{Tag Footer}}
 
{{Tag Footer}}
  
[[Category:Template Tags]]
+
{{DEFAULTSORT:Get_the_post_thumbnail}}
 +
[[Category:テンプレートタグ]]
  
 
[[en:Template Tags/get_the_post_thumbnail]]
 
[[en:Template Tags/get_the_post_thumbnail]]

2010年3月3日 (水) 19:08時点における版

このページ「テンプレートタグ/get the post thumbnail」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

Description

Gets Post Thumbnail as set in post's or page's edit screen. Thumbnail images are given class "attachment-thumbnail"

Usage

<?php echo get_the_post_thumbnail( $id, $size, $attr ); ?>

Parameters

$id
int) (Required) Post ID.
初期値: なし
$size
int) (Optional) Image size.
初期値: 'thumbnail'
$attr
int) (Optional
初期値: なし

Examples

Sample Usage

<?php $pages = get_pages(array('child_of' => 1)); ?> 
<ul>
	<?php foreach ($pages as $page): ?>
		<li>
			<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
			<h1><?=$page->post_title?></h1>
			<?=$page->post_content?>
		</li>
	<?php endforeach; ?>
</ul>

More Options

get_the_post_thumbnail($id);                  // without parameter -> Thumbnail

get_the_post_thumbnail($id, 'thumbnail');     // Thumbnail
get_the_post_thumbnail($id, 'medium');        // Medium resolution
get_the_post_thumbnail($id, 'large');         // Large resolution

get_the_post_thumbnail($id, array(100,100) ); // Other resolutions

Notes

To enable post thumbnails, the current theme must include add_theme_support( 'post-thumbnails' ); in its functions.php file.

変更履歴

  • 2.9 : 新規テンプレートタグ

Source File

get_the_post_thumbnail() is located in wp-includes/post-thumbnail-template.php.

External Resources

最新英語版: WordPress Codex » Template Tags/get_the_post_thumbnail最新版との差分

Related

投稿サムネイル: has_post_thumbnail, the_post_thumbnail, get_post_thumbnail_id, get_the_post_thumbnail, add_image_size(), set_post_thumbnail_size()


関数リファレンステンプレートタグ目次もご覧ください。