2010-02-28 134 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> 
在你的榜样