[wp-trac] [WordPress Trac] #24549: Follow the WP Handbook Standard, and change The Loop of Core Themes to Use Brackets
WordPress Trac
noreply at wordpress.org
Mon Jun 10 15:32:43 UTC 2013
#24549: Follow the WP Handbook Standard, and change The Loop of Core Themes to Use
Brackets
------------------------------------------------+--------------------------
Reporter: chriscct7 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: Bundled Theme | Review
Severity: normal | Version: trunk
Keywords: dev-feedback needs-codex has-patch | Resolution:
------------------------------------------------+--------------------------
Comment (by F J Kaiser):
As this discussion started in my pull request I'll leave my 2 cents as
well.
Let's assume a user wants to change something in his theme. The user gets
pointed at some file that could probably hold the bits our user wants to
change. Then the user opens (for example) the `index.php` file and sees
something like the following:
{{{
<?php
get_header();
( is_home() == TRUE ) AND print __( 'Welcome Home!', 'theme_translation'
);
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<!-- The title of the post -->
<h2>
<?php echo get_the_title(); ?>
</h2>
<!-- The content of the post -->
<?php the_content(); ?>
<!-- The date, tags, categories, etc. -->
<p>
<?php echo get_the_theme_custom_meta_data(); ?>
</p>
<?php
endwhile;
endif;
get_sidebar();
get_footer();
}}}
Now let's assume our user consults a support route, figures out that
there's either a filter or an action for the return value of
`get_the_theme_custom_meta_data()` or the function is a pluggable that can
be overwritten in a child theme.
Now our user has a bunch of problems all related to functions like
[https://github.com/WordPress/WordPress/blob/master/wp-
content/themes/twentythirteen/functions.php#L368
`twentythirteen_entry_meta()`] that have or don't have brackets for their
statements, build strings in different ways and put MarkUp inside PHP. And
this user probably now starts comparing what is written inside
`functions.php` to to what is written in the template file. And then our
user is highly confused.
So (Nacin), if we say ''"Users over IDEs every day of the week."'', then
we should immediately deprecate all Template Tags that `echo` something
directly and ban `&&`, `||` and `^` operators from every theme file. Or in
general: Abandon everything that doesn't clearly speak out what is
happening. To see what we'll be left with, take a look at the bogus
`index.php`-code from above.
Final note: Having a ''WordPress coding "standard"'' is imho nonsense.
Especially if every second case for a single rule is an edge case. I vote
for dropping the "standard".
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24549#comment:18>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list