在wordpress后显示特色图像

代码示例

2
0

在wordpress后显示特色图像

<?php if(has_post_thumbnail()){
  the_post_thumnbail('cstm_name', array( 'class' => 'class1 class2' ))
} else { ?>
  <img class="card-img-top" src="http://placehold.it/750x300" alt="Card image cap" class="img-responsive">
<?php } ?>
0
0

wordpress获取帖子缩略图

<?php 
/* RETURNS a full image resource as: <img class="data..." src="data...">
   ALL parameters are optional. Not needed if you are on WP LOOP
*/
echo get_the_post_thumbnail( $the_query->ID, array( 500, 400) ); 
/* USE get_the_post_thumbnail_url() to get only the image url */
?>

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................