tags:

views:

23

answers:

0

I'm looking for help with my custom content type edit view in wordpress. The content type is up and running perfectly, including adding, editing, and displaying content. However, in my editing display, my custom columns repeat the values for the last record for all of the records. It displays the title correctly, and unique for each post, but the other fields are the same value as the last record entered.

This is the code to edit the columns:

add_filter("manage_edit-peoplemanager_columns", "peoplemanager_edit_columns");

function peoplemanager_edit_columns($columns){
  $columns = array(
    "cb" => "<input type=\"checkbox\" />",
    "title" => "Username",
    "lastname" => "Last Name",
    "firstname" => "First Name",
    "ranks" => "Rank",
  );

  return $columns;
}

And this is the code for populating the custom columns:

add_action("manage_posts_custom_column",  "peoplemanager_custom_columns");

function peoplemanager_custom_columns($column){
  global $post;


  switch ($column) {
    case "lastname":
    $custom = get_post_custom();
      echo $custom["people_lastname"][0];
      break;
    case "firstname":
        $custom = get_post_custom();
      echo $custom["people_firstname"][0];
      break;
    case "ranks":
      echo get_the_term_list($post->ID, 'Ranks', '', ', ','');
      break;
  }
}

Like I said, the title (with the column header "Username") of each record displays correctly, and the first record displays fine, but every other row takes the values of the first record. It seems like it's not looping properly, but I can't find where that breakdown happens.

Any help would be tremendously appreciated. Thank you!