2016-07-23 86 views
0

我希望我的主頁在這個網頁上: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後調整它,但代碼中缺少鏈接到實際崗位。我不知道如何在代碼中實現它。

回答

0
<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> 

,這將產生對你的文章標題

+0

我在哪裏把它放在一個鏈接? – Hhhfpe