繁体   English   中英

我该如何向the_post_thumbnail()添加一个ID?

[英]How can i add an id to the_post_thumbnail()?

我正在尝试处理我的foto画廊上的点击(用于重定向到其他页面)。 为此,我需要为每个图像/缩略图指定一个ID。我正在使用下一个代码,但是它不起作用。

$atbrthumb = array(
    'id' => 'idexample',
);
$image = the_post_thumbnail( $size , $atbrthumb ); 

您可以尝试这样。 这是参考链接

the_post_thumbnail('post-thumbnail', ['class' => 'image-class', 'title' => 'Feature image','id' => 'idexample']);

暂无
暂无

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

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