Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the feedzy-rss-feeds domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /data01/virt126885/domeenid/www.saksadogi.com/codegurus.eu/wp-includes/functions.php on line 6121
Custom columns for custom post type - CodeGurus

Custom columns for custom post type

When using hook “manage_MY_TYPE_NAME_posts_columns” or “manage_MY_TYPE_NAME_posts_custom_column” on WP version >= 3.1 the syntax is little bit changed.

Here’s the example:

add_filter('manage_MY_TYPE_NAME_posts_custom_column', 'my_column_values');
add_filter('manage_MY_TYPE_NAME_posts_columns', 'my_columns');

function my_columns($columns)
{
	$columns['custom_col'] = __('Field name text');
	return $columns;
}

function my_column_values($name, $post_id)
{
	global $post, $typenow;

	// Use $typenow to check custom post type

	switch ($name)
	{
		case 'custom_col':
			echo 'value';
		break;
	}
}

Comments

Leave a Reply