@@ -136,7 +136,7 @@ |
||
| 136 | 136 | /** |
| 137 | 137 | * @param string $template |
| 138 | 138 | * |
| 139 | - * @return string|bool |
|
| 139 | + * @return false|string |
|
| 140 | 140 | */ |
| 141 | 141 | public function template_include( $template ) { |
| 142 | 142 | |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | ->subcompile( $this->getNode( 'query' ) ) |
| 24 | 24 | ->raw( ");\n" ) |
| 25 | 25 | ->write( 'while( $loop->have_posts() ) : $loop->the_post();' . "\n" ); // TODO nested loops |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | $compiler->write( 'while( have_posts() ) : the_post();' . "\n" ); |
| 29 | 28 | } |
| 30 | 29 | |
@@ -56,8 +56,9 @@ |
||
| 56 | 56 | |
| 57 | 57 | $templates = array(); |
| 58 | 58 | |
| 59 | - if ( ! empty( $name ) ) |
|
| 60 | - $templates[] = "{$slug}-{$name}.twig"; |
|
| 59 | + if ( ! empty( $name ) ) { |
|
| 60 | + $templates[] = "{$slug}-{$name}.twig"; |
|
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | $templates[] = "{$slug}.twig"; |
| 63 | 64 | |
@@ -19,8 +19,9 @@ |
||
| 19 | 19 | $parser = $this->parser; |
| 20 | 20 | $stream = $parser->getStream(); |
| 21 | 21 | |
| 22 | - if ( ! $stream->getCurrent()->test( Twig_Token::BLOCK_END_TYPE ) ) |
|
| 23 | - $nodes['query'] = $parser->getExpressionParser()->parseExpression(); |
|
| 22 | + if ( ! $stream->getCurrent()->test( Twig_Token::BLOCK_END_TYPE ) ) { |
|
| 23 | + $nodes['query'] = $parser->getExpressionParser()->parseExpression(); |
|
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | $stream->expect( Twig_Token::BLOCK_END_TYPE ); |
| 26 | 27 | $nodes['body'] = $parser->subparse( array( $this, 'decide_loop_end' ), true ); |
@@ -56,8 +56,9 @@ discard block |
||
| 56 | 56 | if ( is_attachment() ) { |
| 57 | 57 | global $posts; |
| 58 | 58 | |
| 59 | - if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) ) |
|
| 60 | - $this->mime_type = explode( '/', $posts[0]->post_mime_type ); |
|
| 59 | + if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) ) { |
|
| 60 | + $this->mime_type = explode( '/', $posts[0]->post_mime_type ); |
|
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | add_filter( "{$this->mime_type[0]}_template", array( $this, 'query_template' ) ); |
| 63 | 64 | add_filter( "{$this->mime_type[1]}_template", array( $this, 'query_template' ) ); |
@@ -99,8 +100,9 @@ discard block |
||
| 99 | 100 | case 'single': |
| 100 | 101 | $object = get_queried_object(); |
| 101 | 102 | |
| 102 | - if ( $object ) |
|
| 103 | - $templates[] = "single-{$object->post_type}.twig"; |
|
| 103 | + if ( $object ) { |
|
| 104 | + $templates[] = "single-{$object->post_type}.twig"; |
|
| 105 | + } |
|
| 104 | 106 | |
| 105 | 107 | $templates[] = 'single.twig'; |
| 106 | 108 | break; |
@@ -120,11 +122,13 @@ discard block |
||
| 120 | 122 | // if ( $template && 0 === validate_file( $template ) ) |
| 121 | 123 | // $templates[] = $template; |
| 122 | 124 | |
| 123 | - if ( $pagename ) |
|
| 124 | - $templates[] = "page-{$pagename}.twig"; |
|
| 125 | + if ( $pagename ) { |
|
| 126 | + $templates[] = "page-{$pagename}.twig"; |
|
| 127 | + } |
|
| 125 | 128 | |
| 126 | - if ( $page_id ) |
|
| 127 | - $templates[] = "page-{$page_id}.twig"; |
|
| 129 | + if ( $page_id ) { |
|
| 130 | + $templates[] = "page-{$page_id}.twig"; |
|
| 131 | + } |
|
| 128 | 132 | |
| 129 | 133 | $templates[] = 'page.twig'; |
| 130 | 134 | break; |