我有一个自定义查询来获取帖子标题、永久链接和特色图片。但是,帖子标题正在显示,但不在我想要的容器中。以下是查询
<ul class="updatelist">
<?php
$portquery = new WP_Query();
$portquery->query(array(\'cat\' => 3, \'posts_per_page\' => 2));
while ($portquery->have_posts()) : $portquery->the_post();
echo "<li class=\'firstupdate\'>";
?>
<?php
echo \'<span class="thumb-title">\'.the_title().\'</span>\';
?>
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), \'single-post-thumbnail\' ); ?>
<?php
echo "<br><img src=\'".$image[0]."\' />";
?>
<?php endif;
echo "</li>";
?>
<?php endwhile; ?>
<li class="showupdates">
<a href="#">More Blog Updates</a>
</li>
</ul>
这是我得到的输出
<ul class="updatelist">
<li class="firstupdate">
Another Portfolio Post
<span class="thumb-title"></span>
<br>
<img src="http://localhost/sosboston/wordpress/wp-content/uploads/2011/08/thumb-1.jpg">
</li>
<li class="firstupdate">
Portfolio Post
<span class="thumb-title"></span>
<br>
<img src="http://localhost/sosboston/wordpress/wp-content/uploads/2011/08/thumb-1.jpg">
</li>