PHP:没有帖子标题的链接
问题描述:
我希望我的主页在这个网页上:http://goodbyeboringlife.com/显示我最新的任何类别的博客文章。PHP:没有帖子标题的链接
现在,我使用此代码:
<div id='cssmenu'>
<ul>
<?php
$args = array(
'posts-per-page' => 10,
'cat' => 11,
'order' => 'DESC'
);
query_posts($args);
if (have_posts()) :
while (have_posts()) : the_post();
echo "<div class='post-loop-image'>";
if (has_post_thumbnail()) {
the_post_thumbnail();
}
echo "</div>";
echo "<span class='post_title'>" . the_title() . "</span>";
endwhile;
endif;
wp_reset_query();
?>
</ul>
</div>
它看起来如何我想它,我会多用CSS后调整它,但代码中缺少链接到实际岗位。我不知道如何在代码中实现它。
答
<div id='cssmenu'>
<ul>
<?php
$args = array(
'posts-per-page' => 10,
'cat' => 11,
'order' => 'DESC'
);
query_posts($args);
if (have_posts()) :
while (have_posts()) : the_post();
echo "<div class='post-loop-image'>";
if (has_post_thumbnail()) {
the_post_thumbnail();
}
echo "</div>";
echo "<a href='".the_permalink()."'"> <span class='post_title'>" . the_title() . "</span></a>";
endwhile;
endif;
wp_reset_query();
?>
</ul>
</div>
,这将产生对你的文章标题
我在哪里把它放在一个链接? – Hhhfpe