| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function compile( Twig_Compiler $compiler ) { |
||
| 17 | |||
| 18 | $compiler->addDebugInfo( $this ); |
||
| 19 | |||
| 20 | if ( $this->hasNode( 'query' ) ) { |
||
| 21 | $compiler |
||
| 22 | ->write( '$loop = new WP_Query(' ) |
||
| 23 | ->subcompile( $this->getNode( 'query' ) ) |
||
| 24 | ->raw( ");\n" ) |
||
| 25 | ->write( 'while( $loop->have_posts() ) : $loop->the_post();' . "\n" ); // TODO nested loops |
||
| 26 | } |
||
| 27 | else { |
||
| 28 | $compiler->write( 'while( have_posts() ) : the_post();' . "\n" ); |
||
| 29 | } |
||
| 30 | |||
| 31 | $compiler |
||
| 32 | ->subcompile( $this->getNode( 'body' ) ) |
||
| 33 | ->write( 'endwhile;' . "\n" ); |
||
| 34 | } |
||
| 35 | } |