【发布时间】:2013-01-28 21:17:03
【问题描述】:
我正在尝试为我的博客创建一个小型 wp 插件,但我遇到了以下问题。
帖子图片没有显示在正确的位置。
这是正确的 HTML
<li>
<div class="projects">
<ul class="projects sticker">
<li><h2><?php the_title(); ?></h2></li>
<li><p><a href="">details</a></p></li>
</ul>
<img src="" />
</div>
</li>
这就是它现在的显示方式
<li>
<div class="projects">
<ul class="projects sticker">
<li><h2><?php the_title(); ?></h2></li>
<li><p><a href="">details</a></p></li>
</ul>
</div>
</li>
<img src="" />
基本上我必须将img标签放在列表和div中
这是我目前的代码
$args = array( 'numberposts' => '3','category' => $cat_id );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<li>'
. '<div class="projects">'
. '<ul class="projects sticker">'
. '<li>'
. '<h2>'
. '<a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >'
. $recent["post_title"]
. '</a>'
. '</h2>'
. '</li>'
. '<li><p><a href="">details</a></p></li>'
. '</ul>'
. '<img src="'.the_post_thumbnail('thumbnail').'" />'
. '</div>'
. '</a>';
【问题讨论】:
标签: php html wordpress plugins