[wp-hackers] Coding Standards: Functions vs. Classes
Braydon
ronin at braydon.com
Sun Mar 18 19:32:56 UTC 2012
On 03/18/2012 11:39 AM, scribu wrote:
> (...)
>
> Notice the additional boilerplate that this requires. The only advantage of
> a static class variable would be that you can make it private.
Post as a class has more advantages, especially if it were to include
all template tags for posts. It could be $post->excerpt() instead of
the_excert() and you know it can only be the except of that post and not
from the global state of $post. Would be one less point of confusion to
not stumble on, especially if you're new and haven't yet figured out
that the global $post is super important.
More information about the wp-hackers
mailing list