[wp-hackers] Returning instead of echoing

Owen Winkler ringmaster at midnightcircus.com
Thu Nov 11 14:40:45 UTC 2004


the_* Conversion Guide
rev.#1 - Please amend/comment

In the interests of facilitating the use of template tags for the novice 
user, and leaving a rich API open for developers, the functions that 
produce output in a template should be renamed following these rules:

* Any output-producing function beginning with "the_" should have a 
corresponding "get_the_" function that accepts the same arguments and 
returns its value rather than echoing.

* Functions that don't begin with "the_" yet produce output in 
index.php, header.php, footer.php, or sidebar.php need to be converted 
to the "the_"/"get_the_" style also, while leaving their original 
version for future deprication.

* Filters that are applied to output should be applied in the "get_the_" 
function and not the "the_" function.  The "the_" function should simply 
echo the "get_the_" function's output.  Existing function pairs that 
don't follow this structure need to be changed.


Questions::
Should all get_ functions be converted to parse_str argument format?

What do you think of this:
if(!is_array($a))parse_str($a);extract($a);

Should all get_ functions have any echo functionality removed?

Should all function args be documented in code?

Owen




More information about the hackers mailing list