Closed phlbnks closed 5 years ago
Thanks for the PR!
Does this provide much advantage over using the function
argument for controlling the output of each field? https://github.com/johnbillion/extended-cpts/wiki/Admin-columns#custom-function
It seems like they're quite close in terms of functionality.
Gah - I should have tested this, sorry. From the docs I took it that using a custom function disabled column sorting (it does if you just copy the example to accomplish something like ucfirst). But actually it looks if you specify the meat_key as well, then you retain the nice sortable columns.
I suppose there could be some value in a meta_format as that implies that it is only for output styling of the meta_value rather than anything else, but since this can actually be accomplished with a custom function anyway that might just be bloat.
Good point, I'll update the docs to make it clearer that you can combine the function
argument with the others.
I can see the value of a meta_format
argument (and maybe even a term_format
argument), but I think once you get into customisation of output it's better to allow complete control via the function
argument instead.
I'll close this PR and I'll get the docs updated with some better examples. Cheers.
Full disclosure - I haven't run the tests or thought through potential security implications, but this is a feature missing compared to doing it manually. With the manual method you can have a "simple" column with a meta_value in it (so have sorting/filtering etc all work neatly), but use simple functions to affect display only such as
ucfirst
.This adds a simply extra arg analgous to date_format called meta_format that is passed to call_use_func to be run on $val.