2010-02-28 136 views
0

我在我正在工作的網站的首頁上使用兩個WP查詢。他們每個檢索一個職位。第一個查詢獲取「新聞」類別中的最新帖子,第二個查詢獲取除「新聞」類別之外的博客中的最​​新帖子。WordPress的「閱讀更多」不起作用

這工作正常。

但是,我似乎無法得到「更多閱讀」的工作。是否因爲我不使用標準查詢?

<div class="column_left"> 
<h3>Fresh news</h3> 
<p><span class="date"><?php the_time('j F, Y') ?>. Timed <?php the_time('G:i') ?></span></p> 
<?php 
    $news = new WP_Query('cat=19&showposts=1'); 

    while ($news->have_posts()): 
     $news->the_post(); 
     global $more; 
     $more = 0; 

     the_content('Read more &raquo;'); 
    endwhile; 
?> 
</div> 

<div class="column_right"> 
<h3>Collected from the blog</h3> 
<?php 
    $blog = new WP_Query('cat=-19&showposts=1'); 

    while ($blog->have_posts()): 
     $blog->the_post(); 
     global $more; 
     $more = 0; 

     the_content('Read more &raquo;'); 
    endwhile; 
?> 
</div> 

你能看到我在做什麼錯嗎?

回答

2

如果您想了解更多的話,我會用the_excerpt,因爲這是你的內容的短單,或者您可以使用此:

... 

$more = 0; 

echo get_content().'<a href="'.get_permalink().'" title="Read More">Read More &raquo;</a>'; 

endwhile; 

<a href="<?php the_permalink(); ?>" title="Read More">Read More &raquo;</a> 
在你的榜樣