Edit the admin post type title column

To edit the Admin header of your new post type page you need to add the following code:

add_action(‘admin_head-edit.php‘,’edit_change_title_function’);

in your function you have to check if the post type is the one you need, and then apply a filter for the title

function edit_change_title_function(){
global$post;
if($post->post_type == 'posttype_name') {
add_filter('the_title','posttype_title_function',100,2);
}
}

So, you can override the title getting the value from db:

function posttype_title_function($title, $post_id) {
$new_title = get_post_meta($post_id,'slb_first_name',true) .' '.get_post_meta($post_id,'slb_last_name',true);
return $new_title;
}
WordPress Custom Post Type

Post types are a way to categorize different types of content in WordPress.

WordPress has already the following native post type:

  • Post
  • Pages
  • Attachments
  • Revisions
  • Navigation menu
  • custom CSS
  • Changeset

Most probably you just knew about the first three in the list.

And you can extend these wordpress post type with your own.

To do this you here it is a little function recap.

 

There is another way to create a custom post type. It’s using the plugin Custom Post Type UI (or CPTUI). In this case you can create your post types directly in the wordpress admin with a simple UI.

Of course it depends on what you need from Custom Post Types.

If you are creating a plugin it’s better to create them inside it.

If you need them only for you personal use then it’s easer to use CPTUI.

 

That’s it