0
我正在學習如何製作我自己的WordPress插件,目前我很困惑,如果沒有縮略圖,那麼我會使用默認圖像作爲縮略圖。 代碼,我使用:WordPress的縮略圖添加動作,如果沒有縮略圖
add_action('the_post', 'mythumb');
function mythum(){
if (!has_post_thumbnail()) {
$defaultthum = "http://example.com/default.jpg"
echo ('<div class="featured-thumbnail"><img width="150" height="150" src="'.$defaultthum.'" class="attachment-featured wp-post-image" alt="7" title="" /></div>')
}
}
我的問題:默認的圖像縮略圖不是在正確的位置。 見此圖:http://s22.postimg.org/ezt05f59d/Lm_XUp.png 有什麼想法?或者鉤子不是the_post? 謝謝