Post Columns

add_filter( 'manage_posts_columns', 'add_column_name' );

function add_column_name($defaults) {
$defaults['positions'] = __('Positions');
$defaults['facility'] = __('Facility');
unset($defaults['comments']);
unset($defaults['author']);
unset($defaults['tags']);
unset($defaults['date']);
return $defaults;
}

function get_custom_fields($column_name, $id)
{
if( $column_name == 'positions' )
{
$positions = get_post_meta($id, 'mm_positions', true);
echo $positions;
}

if( $column_name == 'facility' )
{
$facility = get_post_meta($id, 'mm_facility', true);
echo $facility;
}

}

add_action('manage_posts_custom_column', 'get_custom_fields', 10, 2);

0 Comments

You must be logged in to post a comment.