Custom Post Type, Custom Columns List

Hi @Zack:

I’m going out on a limb here since your question wasn’t clear. It sounds like you want to be able to display the first and last name of the visitor in the vistor listing instead of “Auto Draft?” If so this code should work for you:

add_action( 'the_title', 'make_vistor_title', 10, 2 );
function make_vistor_title($title,$post_id) {
  global $pagenow,$typenow;
  if ($pagenow=='edit.php' && $typenow=='visitor') {
    return the_visitor_title($post->ID);
  }
  return $title;
}    
function the_visitor_title($post_id) {
  return get_post_meta( $post_id, 'v_f_name', true ) . ' ' . 
         get_post_meta( $post_id, 'v_l_name', true );
}

If you want the title to work no matter where you are use this version of make_visitor_title() instead:

function make_vistor_title($title,$post_id) {
  $post = get_post($post_id);
  if ($post->post_type=='visitor') {
    $title = the_visitor_title($post->ID);
  }
  return $title;
}    

Of course another (better?) option would be to use capture the names on POST and create a title based on the values in your two (2) custom meta fields 'v_f_name' and 'v_l_name' using code like the following (which is far more complex that I would like it to be but that’s what it took me to get it working – maybe someone else could suggest a simpler way?):

add_action( 'admin_init', 'visitor_post_admin_init', 10, 2 );
function visitor_post_admin_init() {
  global $pagenow;
  if ($pagenow=='post.php' && isset($_POST['action']) && $_POST['action']=='editpost') {
    if (empty($_POST['post_title'])) {
      $_POST['post_title'] = get_visitor_title_from_POST($_POST);
    }
  }
}
add_action( 'wp_insert_post_data', 'insert_visitor_data', 10, 2 );
function insert_visitor_data($data,$postarr) {
  if ($data['post_type']=='actor' && !in_array($data['post_status'],array('draft','auto-draft'))) {
    if (isset($postarr['meta'])) {
      extract($postarr);
      $post_title = get_visitor_title_from_POST($postarr);
      if (!empty($post_title))
        $data['post_title'] = trim($post_title);
      $post_name = sanitize_title_with_dashes($post_title);
      $data['post_name'] = wp_unique_post_slug($post_name, $ID, $post_status, $post_type, $post_parent);
    }
  }
  return $data;
}
function get_visitor_title_from_POST($POST) {
  $meta = array();
  foreach($POST['meta'] as $key_value)
    $meta[$key_value['key']] = $key_value['value'];
  if (isset($POST['metavalue'])) {
    if (isset($POST['metakeyselect']) && $POST['metakeyselect']!='#NONE#') {
      $meta[$POST['metakeyselect']] = $POST['metavalue'];
    } else {
      $meta[$POST['metakeyinput']] = $POST['metavalue'];
    }
  }
  $title = (isset($meta['v_f_name']) ? "{$meta['v_f_name']} " : '');
  if (isset($meta['v_l_name']))
    $title .= $meta['v_l_name'];
  return trim($title);
}