[wp-hackers] Regarding wp markup language
Mike Schinkel
mikeschinkel at newclarity.net
Mon Apr 19 21:07:51 UTC 2010
On Apr 19, 2010, at 10:30 AM, Jeremy Clarke wrote:
> For your consideration:
>
> function the_loop($args) {
> $defaults = array (
> 'query' => '', // Default uses current page query, this overrides
> it with new WP_Query()
> 'post_display_callback' => '', // Custom post display function,
> overrides default.
> 'loop_start_callback' => '', // Optional callback for start of
> loop
> 'loop_end_callback' => '', // Optional callback for end of loop
> 'before' => '', // Show this before loop if there are posts
> (easier than callback)
> 'after' => '', // Show this after loop if there are posts (easier
> than callback
> );
> $args = wp_parse_args($args, $defaults);
> extract($args, EXTR_SKIP);
> [...]
> }
+1
I like, very much! But I would opt for shorter names. This would become a well-known standard so clarity in naming wouldn't be as important, and I really don't want to have to type those long names over and over... :)
I'd also add a "where" callback for choosing to display or not display those posts which can't be easily filtered by a query string.
function the_loop($args) {
$defaults = array (
'query' => '',
'display' => '',
'where' => '',
'start' => '',
'loop' => '',
'before' => '',
'after' => '',
);
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
[...]
}
That said, why don't you create a plugin for this first? Those of us who like it can use it and harden it together, and once it's baked consider rolling into core?
-Mike
More information about the wp-hackers
mailing list