Rarst\Meadow\Loop_Node::compile PHP Method

compile() public method

public compile ( Twig_Compiler $compiler )
$compiler Twig_Compiler
    public function compile(Twig_Compiler $compiler)
    {
        $compiler->addDebugInfo($this);
        if ($this->hasNode('query')) {
            $compiler->write('$loop = new WP_Query(')->subcompile($this->getNode('query'))->raw(");\n")->write('while( $loop->have_posts() ) : $loop->the_post();' . "\n");
            // TODO nested loops
        } else {
            $compiler->write('while( have_posts() ) : the_post();' . "\n");
        }
        $compiler->subcompile($this->getNode('body'))->write('endwhile;' . "\n");
    }
Loop_Node