簡體   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