[theme-reviewers] Question about use of core WP functions in theme
gxxaxx at gmail.com
Thu Aug 11 14:59:49 UTC 2011
A comment was made in a recent thread expressing the opinion that
using core WP functions were *always* preferred to rolling your own.
This is a slight restatement. Chip's actual statement is at the bottom
of this email. Point is this reminded me that I am not comfortable
with some of the design solutions I have been using recently.
I'll give you an example. In a recent special page I had need for a
string of the_content.
Because the_content does not have an option for echo=false, I was
forced to reproduce the innards of the function.
$mycontent = get_the_content();
$mycontent = apply_filters('the_content', $mycontent);
$mycontent = str_replace(']]>', ']]>', $mycontent);
.... do stuff with $mycontent
This means that if a fix is applied to the_content function my theme
will not automatically have the advantage of the update. There are
quite a few functions with forced echo: the_content, the_excerpt,
post_class, body_class, the_meta, and the_guid.
I'm thinking there is a different design solution that I should be
using. Or, could it be that adding echo=false is somewhere in queue
for future release?
Just wondering about the best practices here.
Proper quote as promised.
On Thu, Aug 11, 2011 at 5:57 AM, Chip Bennett <chip at chipbennett.net> wrote:
> In general, though, IMHO, it is *always* preferable to use a core WP
> function for content filtering and/or untrusted data
More information about the theme-reviewers