在wordpress上将标题与缩略图分开

Separating title from thumbnail on wordpress

我正在做一个 wordpress 主题,我试图在侧边栏上最近 post 的缩略图和 post 标题之间创建一些边距。我尝试了一切,但就是行不通。有什么建议吗?

<?php $recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ){
if($recent['post_status']=="publish"){
if ( has_post_thumbnail($recent["ID"])) {
    echo '<li style=" list-style: none; ">
    <a class="post-title" href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   get_the_post_thumbnail($recent["ID"], 'thumbnail').$recent["post_title"].'</a></li> ';
}else{
    echo '<li style=" list-style: none; ">
    <a class="post-title" href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a></li> ';
}
 }
}
?> 

你试过在它们之间插入一个分隔线吗?

get_the_post_thumbnail($recent["ID"], 'thumbnail') . '<br />' . $recent["post_title"].'

将此添加到 CSS 文件:

img.attachment-thumbnail { margin:10px; }