[wp-hackers] More Hook Requests

Jamie Talbot wphackers at jamietalbot.com
Fri Jan 13 13:57:32 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Jaquith wrote:
> On Jan 13, 2006, at 4:38 AM, Jamie Talbot wrote:
> 
>> could we have the same kind of pair for the edit-pages.php table 
>> too?
>> 
>> 'manage_pages_columns' and 'manage_pages_custom_column'
> 
> 
> Reasonable hook requests such as this are rarely (ever?) turned down.
>  Write a patch quick, and it might make it into 2.0.1!
> 

Done!  This patch adds hooks 'manage_pages_columns' and
'manage_pages_custom_column' that are the equivalent of
'manage_posts_columns' and 'manage_posts_custom_column'.  You can call
them in exactly the same way, using the same callback functions:

add_filter('manage_pages_columns', 'my_manage_posts_columns');
add_action('manage_pages_custom_column',
'my_manage_posts_custom_column', 10, 2);

function my_manage_posts_columns(& $post_columns)
{
	$post_columns['gengo_language'] = __('Language', GENGO_DOMAIN);
	return $post_columns;
}
	
function my_manage_posts_custom_column($column_name, $id)
{
	// Check it's our column.
	if ('gengo_language' != $column_name) return;
	echo get_language_by_id($id);
}

As a side effect, it also now displays the Owner column correctly in all
cases, which it didn't seem to do in the past.  It seems to present the
table correctly in all the situations I could throw at it, but it did
require a bit of code shifting around because of the way the logic was
set out previously, so please test it out and see how it goes.

Screenshot:

http://jamietalbot.com/wp-hacks/miscellaneous/editpagehookuse.png

Cheers,

Jamie.

- --
http://jamietalbot.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDx7HLrovxfShShFARAvjrAJ91aMlB0tKsvHJ4SSNWz1Owt9uErQCeP9Fg
shxjPONQHs81C0hDB87+1LU=
=M8CG
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list