Php query_帖子在循环中创建不需要的摘录和标题链接
由于某些原因,在第一篇文章之后,从Php query_帖子在循环中创建不需要的摘录和标题链接,php,wordpress,Php,Wordpress,由于某些原因,在第一篇文章之后,从摘录和标题检索的内容中创建了一些链接。你知道为什么会这样吗 <?php if ( have_posts() ) : ?> <?php query_posts('category_name=uncategorized&showposts=3'); ?> <?php while (have_posts()) : the_post(); ?> <br /> <?php echo the_post_th
摘录
和标题
检索的内容中创建了一些链接。你知道为什么会这样吗
<?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(); ?> <br />
<?php
the_excerpt();
endwhile;
wp_reset_postdata();
endif;
?>
这里是网站,它是“最新新闻”部分,在你向下滚动后。。。
谢谢
我以前遇到过,不记得确切的解决方案,但我认为您的循环顺序错误。。。试着先做我上面发布的,然后发布它是否修复了它。query\u posts()应该在循环的开始,wp\u reset\u postdata()应该在循环的最后。
像这样:
`
我修复了它,由为“继续阅读”部分创建的
标记被提前切断,这意味着第一个标记从未关闭,之后的所有内容都作为链接保留
无论如何,谢谢你的帮助。我认为这与字符有关,在
标签关闭之前,“继续阅读”链接被切断。好的,太好了。。。确保你像我和罗纳德的帖子一样正确地排列循环。
<?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();
?>
<?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(); ?> <br />
<?php
the_excerpt();
endwhile;
endif;
wp_reset_postdata();
?>`