[theme-reviewers] Question about use of core WP functions in theme
Chip Bennett
chip at chipbennett.net
Thu Aug 11 15:08:00 UTC 2011
Skimming your question briefly: is there any particular reason you can't use
get_the_content()?
Chip
On Thu, Aug 11, 2011 at 9:59 AM, Claude Needham <gxxaxx at gmail.com> wrote:
> 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.
>
> Regards,
> Claude Needham
>
>
> 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
> > sanitization/validation.
> > Chip
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110811/8c550bc1/attachment.htm>
More information about the theme-reviewers
mailing list