简体   繁体   English

如何在首页的特色图片中放置图库图标?

[英]how to put gallery icon in featured image on home page?

if you check Marie Claire website : http://www.marieclaire.fr/ 如果您查看Marie Claire网站: http : //www.marieclaire.fr/

in each post that have slider gallery inside , they put a small icon gallery on the featured image of the post . 在每个内含滑块画廊的帖子中,他们在帖子的特色图片上放置一个小图标画廊。 what the condition to put it , how can be done for a WordPress website ?? 放在什么条件下,如何为WordPress网站完成? 图片点击

i have this code for show image : 我有此代码用于显示图像:

 function show_image($args, $caption = '') { $postid = ''; $video = ''; $image_size = 'large'; $before = ''; $after = ''; $display = true; $img_str = ''; $issingle = false; extract($args); if($postid == '') { return false; } $videostyle = ""; $isvideo = isvideopost($postid); $img_str = ""; $thumbid = get_post_thumbnail_id( $postid ); $image = wp_get_attachment_image_src( get_post_thumbnail_id( $postid ), $image_size ); if($image) { $image_file = $image[0]; $img_str .= $before; if($isvideo == true && $issingle == false){ $img_str .= '<div class="videoimage">'; $videostyle = 'style="position: relative; top: 0; left: 0;"'; }elseif(has_term( 'video', 'post_tag',$postid)==true && $issingle == false){ $img_str .= '<div class="videoimage">'; $videostyle = 'style="position: relative; top: 0; left: 0;"'; } $img_str .= '<img src="'.$image_file.'" '.$videostyle.'>'; if($isvideo == true && $issingle == false){ $img_str .= '<img src="'.THEME_URL.'/images/playicon/playicon_'.$image_size.'.png" style="position: absolute; top: 0; left: 0;"/>'; $img_str .= '</div>'; }elseif(has_term( 'video', 'post_tag',$postid)==true && $issingle == false){ $img_str .= '<img src="'.THEME_URL.'/images/playicon/playicon_'.$image_size.'.png" style="position: absolute; top: 0; left: 0;"/>'; $img_str .= '</div>'; } $img_str .= $after; if($display == true) { echo $img_str; }else{ return $img_str; } }else{ return false; } } 

what i need is to add codition if exist attachements image to show this icon on featured image 我需要添加编码(如果存在附件图像)以在特色图像上显示此图标

You can directly upload a image from Set featured image link in the post. 您可以从帖子中的“ Set featured image链接直接上传图片。 And you access it using the_post_thumbnail( 'thumbnail' ); 然后使用the_post_thumbnail( 'thumbnail' );访问它the_post_thumbnail( 'thumbnail' ); . You can get more idea from https://developer.wordpress.org/reference/functions/the_post_thumbnail/ . 您可以从https://developer.wordpress.org/reference/functions/the_post_thumbnail/了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM