I've basically done a full plugin and now just "prettifying" it sort-of. One thing I'm doing is re-doing the columns for listing the "posts" I made. This part is fine, and all columns are replaced as needed, however, there's one column that puzzles me.. the title field. :/
add_action( 'manage_posts_custom_column', array( &$this, '_wp_filter_visitor_column_view' ) );
add_filter( 'manage_edit-visitor_columns', array( &$this, '_wp_filter_visitor_columns' ) );
public function _wp_filter_visitor_column_view( $column )
{
global $post;
if ( $column == "title" )
{
$name = get_post_meta( $post->ID, 'v_f_name', true );
$name .= ' ' . get_post_meta( $post->ID, 'v_l_name', true );
echo $name;
}
elseif ( $column == "type" )
{
echo "Not available right now...";
}
elseif ( $column == "loggedin" OR $column == "workstation" )
{
$workstation = get_post_meta( $post->ID, 'v_workstation', true );
if ( $column == "workstation" ) echo $workstation;
elseif ( $column == "loggedin" ) echo ( !empty($workstation) OR !isset( $workstation ) ) ? 'No' : 'Yes';
}
elseif ( $column == "id" )
{
echo get_post_meta( $post->ID, 'v_id', true );
}
}
public function _wp_filter_visitor_columns( $columns )
{
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Name',
'type' => 'Type',
'loggedin' => 'Logged In?',
'id' => 'Visitor ID',
);
return $columns;
}
The column header for "title" => "Name" appears properly, but the column data displays the default title of "Auto Draft" because I'm not using the post's title field. Do I need to the post's title field for custom post types or will auto-generated titles suffice? I have no need for the title field and would rather use the postmeta table for storing my data.
-Zack
P.S. I was following this tutorial for creating the columns.