0

出于某种原因,在第一次发布之后,从the_excerpt和检索到的内容创建了链接the_title。任何想法为什么会发生这种情况?

<?php 
if ( have_posts() ) : ?>

<?php query_posts('category_name=uncategorized&showposts=3'); ?> <?php
while (have_posts()) : the_post(); ?>
<br /> 
<?php echo the_post_thumbnail( 'latest-news'); ?>
<?php 
the_title(); ?> &nbsp; <br />
<?php
the_excerpt();
endwhile;
wp_reset_postdata();
endif; 
?>

这是网站,向下滚动后是“最新消息”部分... http://hailstorm_new.hailstormcommerce.com/ 谢谢

4

3 回答 3

0

我修复了它,为“继续阅读”部分<a>创建的标签很the_excerpt早就被切断了,这意味着第一个标签永远不会关闭,它后面的所有内容都作为链接。

无论如何感谢您的帮助。

于 2012-10-31T11:47:59.707 回答
0

query_posts() 应该在循环的开头, wp_reset_postdata() 应该在最后。像这样:

<?php 
    query_posts('category_name=uncategorized&showposts=3');
    if ( have_posts() ) :
        while (have_posts()) : the_post(); ?>
<br /> 
<?php 
            echo the_post_thumbnail( 'latest-news');
            the_title(); ?> &nbsp; <br />
<?php
            the_excerpt();
        endwhile;
    endif;
    wp_reset_postdata();
?>`
于 2012-10-31T11:38:56.073 回答
0
<?php query_posts('category_name=uncategorized&showposts=3'); ?>
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
<br /> 
   <?php echo the_post_thumbnail( 'latest-news'); ?>
   <?php the_title(); ?>
   <br />
   <?php the_excerpt();
endwhile;
endif; 
wp_reset_postdata();
?>

I've come across it before, can't remember the exact solution but I think your loop is ordered wrong... Try doing what I've posted above first, then post whether it fixed it or not.

于 2012-10-31T11:22:51.487 回答