每个魔术场都不停止,迭代太多


Magicfields foreach not stopping, iterating too many

为Wordpress 3.1使用magicfields 2.0插件
这是破损的页面:http://sseko.wecreativeagency.com/style/

,这是它工作的页面:
http://sseko.wecreativeagency.com/university-bound/

注意第一页的页脚正在接收来自magicfields的id信息

<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <article  id="post-<?php the_ID(); ?>">
            <?php the_content(); ?> 
            <div id="note" class="grid_12"><p class="note grid_6 alpha"><span class="special">Style your Ssekos!</span> There are so many ways to tie your Ssekos. Watch the videos and learn how! Then, come up with your own!</p><h1 class="grid_6 omega"><?php wp_title(' ','true','right'); ?></h1></div>                   
            <?php $styles = getFieldOrder('image'); 
                                if(is_array($styles))
                                {foreach($styles as $style)
                                    {
                                     echo "<div class='grid_3'>";
                                     echo "<a rel='styles' href='#info$style'class='inlineimg grid_3'>";
                                     echo "<img src='";
                                     echo get_image('image',1,$style,$tag_img=0);
                                     echo "'class='grid_3' title='";
                                     echo get('name',1,$style);
                                     echo "'alt='";
                                     echo get('name',1,$style);
                                     echo "'";                                       
                                     echo "</a>";
                                     echo "<h2 class='grid_3'>";
                                     echo get('name',1,$style);
                                     echo "</h2></div>";
                                     echo "<div style='display:none'><div id='info$style' class='grid_8 lightbox'>";
                                     echo get('link',1,$style);
                                     echo "</div></div>";
                                    }
                                }
                                ?>
    <div class="clear"></div>   
    </article>
    <?php endwhile; endif; ?>

我已经检查了数据库中是否有额外的条目,但我找不到它继续迭代到下面元素的原因。

由于某些原因,我无法查看您的网站。但我相信这是因为你有两个嵌套的循环…一个是Wordpress循环if--> while,然后是Foreach循环。当Wordpress循环遇到帖子时,它会为每一个帖子迭代第二个循环…例如,在有10个$post的页面上,它将为每个$style迭代10次…当有1个post时,它将迭代一次。就像我说的,由于某种原因你的网站是不可用的,但看到你的URL建设,我的猜测是,它不工作在第一个例子,因为它是某种类别(返回多个帖子)和第二个URL是一个单一的帖子…