@Claude, good point.<div><br></div><div>By the way, since in my freelance job I have a 3rd party CMS I'm using with the similar issue, we do use output buffering as a solution to this:</div><div><br></div><div>ob_start();</div>
<div>inner_annoying_always_echo_func();</div><div>$content = ob_get_contents();</div><div>ob_end_clean();</div><div><br></div><div>This is not the best practice, but aside of the buffering (speed plus) it would affect the function in no way even after change of the implementation.</div>
<div><br></div><div>Any comments on this?<br clear="all"><br>Mario Peshev<br>freelance software developer/trainer<br><a href="http://www.linkedin.com/in/mpeshev">http://www.linkedin.com/in/mpeshev</a><br><a href="http://peshev.net/blog">http://peshev.net/blog</a><br>
<br>
<br><br><div class="gmail_quote">On Thu, Aug 11, 2011 at 5:59 PM, Claude Needham <span dir="ltr"><<a href="mailto:gxxaxx@gmail.com">gxxaxx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
A comment was made in a recent thread expressing the opinion that<br>
using core WP functions were *always* preferred to rolling your own.<br>
This is a slight restatement. Chip's actual statement is at the bottom<br>
of this email. Point is this reminded me that I am not comfortable<br>
with some of the design solutions I have been using recently.<br>
<br>
I'll give you an example. In a recent special page I had need for a<br>
string of the_content.<br>
<br>
Because the_content does not have an option for echo=false, I was<br>
forced to reproduce the innards of the function.<br>
$mycontent = get_the_content();<br>
$mycontent = apply_filters('the_content', $mycontent);<br>
$mycontent = str_replace(']]>', ']]&gt;', $mycontent);<br>
.... do stuff with $mycontent<br>
<br>
This means that if a fix is applied to the_content function my theme<br>
will not automatically have the advantage of the update. There are<br>
quite a few functions with forced echo: the_content, the_excerpt,<br>
post_class, body_class, the_meta, and the_guid.<br>
<br>
I'm thinking there is a different design solution that I should be<br>
using. Or, could it be that adding echo=false is somewhere in queue<br>
for future release?<br>
<br>
Just wondering about the best practices here.<br>
<br>
Regards,<br>
Claude Needham<br>
<br>
<br>
Proper quote as promised.<br>
On Thu, Aug 11, 2011 at 5:57 AM, Chip Bennett <<a href="mailto:chip@chipbennett.net">chip@chipbennett.net</a>> wrote:<br>
> In general, though, IMHO, it is *always* preferable to use a core WP<br>
> function for content filtering and/or untrusted data<br>
> sanitization/validation.<br>
> Chip<br>
_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
</blockquote></div><br></div>