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? 谢谢