Open
Description
The WordPress coding standards state:
You are free to use the alternative syntax for control structures (e.g. if/endif, while/endwhile)—especially in your templates where PHP code is embedded within HTML, for instance:
<?php if ( have_posts() ) : ?>
<div class="hfeed">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID() ?>" class="<?php post_class() ?>">
<!-- ... -->
</article>
<?php endwhile; ?>
</div>
<?php endif; ?>
The current version of the standard does not allow this though. Newline required after opening brace
is thrown for the following code snippets:
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
Running phpcbf
on these two examples will produce the following, respectively:
<?php
while ( have_posts() ) :
the_post();
?>
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>