• We are available for any Development work:
  • Email us at: programmer_heart@yahoo.com

Modifying Admin Post Lists In WordPress

All we need is a definition of the labels that we’re going to use and a few settings. Open up your functions.php file and drop the following into it.


add_filter('manage_models_posts_columns', 'MT4_columns_models_head');
add_action('manage_models_posts_custom_column', 'MT4_columns_content', 10, 2);

// ADD TWO NEW COLUMNS
function MT4_columns_models_head($defaults) {
$defaults['first_column']  = 'First Name';
$defaults['second_column'] = 'Phone';
$defaults['third_column'] = 'Email';
return $defaults;
}

function MT4_columns_content($column_name, $post_ID) {
if ($column_name == 'first_column') {
echo get_post_meta( $post_ID, 'models_fname', true );  // here i used the meta value you can used your own value
}
if ($column_name == 'second_column') {
echo get_post_meta( $post_ID, 'models_phone', true );// here i used the meta value you can used your own value
}
if ($column_name == 'third_column') {
echo get_post_meta( $post_ID, 'models_email', true );// here i used the meta value you can used your own value
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

Press Enter to Search