Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 一个小脚本把wordpress的博客文章搞乱了_Php_Wordpress - Fatal编程技术网

Php 一个小脚本把wordpress的博客文章搞乱了

Php 一个小脚本把wordpress的博客文章搞乱了,php,wordpress,Php,Wordpress,我使用此脚本显示最近的帖子: <ul> <?php query_posts('showposts=5'); ?> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <li><?php the_

我使用此脚本显示最近的帖子:

<ul>
<?php query_posts('showposts=5'); ?>

<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>

<li><?php the_content_limit(250); ?></li>
<?php endwhile;?>
</ul>
我把它放在header.php中。它完成了任务,但是所有其他的帖子和页面都被弄乱了。当我尝试加载任何普通页面(page.php)时,我只从两篇博客文章和类似问题中获取内容。这不是内容限制的问题。我也试过摘录——也是一样


有没有办法避免这个问题,但最近还是有帖子?

你通常不会把
query\u posts
放在标题中。尝试创建一个新的文件,在新的查询使用此

之前将其包含在其中,如何处理?你想干什么?在这里发布之前阅读常见问题:事实上,他在同一页上得到了重复的内容,但他没有解释清楚。