Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.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 自定义主题上的无限重直接循环错误_Php_Wordpress - Fatal编程技术网

Php 自定义主题上的无限重直接循环错误

Php 自定义主题上的无限重直接循环错误,php,wordpress,Php,Wordpress,我在wordpress安装中设置了自定义主题。我一直在本地开发,一切都很好 今晚我上传到我的服务器上,正在安装新的wordpress。我打开了永久链接,突然间,我的自定义类别页面造成了无限的直接循环 我的.htaccess是可写的,所以我认为这不是问题所在(我在网上看到过很多这样的内容) 下面是我的一个自定义页面中的代码——它来自一个特定的类别——有人知道如何解决这个问题吗 <?php get_header(); ?> <?php /* Template Name: Po

我在wordpress安装中设置了自定义主题。我一直在本地开发,一切都很好

今晚我上传到我的服务器上,正在安装新的wordpress。我打开了永久链接,突然间,我的自定义类别页面造成了无限的直接循环

我的.htaccess是可写的,所以我认为这不是问题所在(我在网上看到过很多这样的内容)

下面是我的一个自定义页面中的代码——它来自一个特定的类别——有人知道如何解决这个问题吗

<?php get_header(); ?> 


<?php
/*
Template Name: Podcasts
*/
?>

<ul class="mcol">

<?php
query_posts("cat=1");

while(have_posts()) : the_post(); ?>
            <li class="article" id="post-<?php the_ID(); ?>">

        <?php
        if ( has_post_thumbnail() ) { ?>
                    <?php 
                    $imgsrcparam = array(
                    'alt'   => trim(strip_tags( $post-    >post_excerpt )),
                    'title' => trim(strip_tags( $post->post_title )),
                    );
                    $thumbID = get_the_post_thumbnail( $post->ID, array(200,200), $imgsrcparam ); ?>
                    <div class="preview"><a href="<?php the_permalink() ?>"><?php echo "$thumbID"; ?></a><div class="front-titles"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div></div>


                <?php } else {?>
                    <div class="preview"><a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/images/default-thumbnail.jpg" alt="<?php the_title(); ?>" /></a></div>

                <?php } ?>

                <div class="article-over">



                </div>
            </li> <?php ?>
        <?php endwhile;
        //Reset Query
        wp_reset_query();
        ?>
        </ul>

        <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
        <?php endwhile; ?>
        <?php else : ?>
            <h1 id="error"><?php _e("Sorry, but you are looking for something that isn&#8217;t here."); ?></h1>
        <?php endif; ?>

<div class="pagination"><?php previous_posts_link('<< Newer Entries', 0) ?> <?php     next_posts_link('Older Entries >>', 0); ?> </div>
<?php get_footer(); ?>


    你做的很奇怪

  • query_posts用于更改主循环
  • 在同一页上有两个不同语法的循环

  • 第二个循环没有做任何事情,所以请删除它,并使用
    get_posts
    WP Query
    进行自定义查询。

    谢谢-抱歉,顺便说一句,我在这种情况下完全是n00b,所以可能有很多错误。我会尝试你的建议。作为旁白-我的网站在我关闭永久链接时运行良好-我只需要打开永久链接。感谢你指出上述内容-这不是导致问题的原因,但它提供了很好的信息,因为我可以改进我的php。问题是(我认为)Wordpress规范重定向与.htaccess重定向冲突。我禁用了wordpress规范重定向,它似乎又开始工作了。