因此,我使用自定义字段定义了“客户”类型的自定义帖子类型,如下所示:
// Clients
register_post_type( 'isa_client',
array(
'labels' => array(
'name' => __( 'Clients' ),
'singular_name' => __( 'Client' )
),
'public' => true,
'has_archive' => true,
'hierarchical' => false,
'show_ui' => true,
'show_in_menu' => 'mnuIsAppointments',
'rewrite' => true,
'supports' => array('thumbnail')
)
);
并且还指定了在admin客户端页面上显示的列,如下所示:
add_filter("manage_edit-isa_client_columns", "isa_client_edit_columns");
function isa_client_custom_columns($column){
global $post;
switch ($column)
{
case "isa_client_salutation":
$custom = get_post_custom();
echo "<b><a href=" . get_edit_post_link($post->id) . ">" . $custom["isa_client_salutation"][0] . " " . $custom["isa_client_name"][0] . " " . $custom["isa_client_surname"][0] . "</a></b>";
break;
case "isa_client_phone":
$custom = get_post_custom();
echo $custom["isa_client_phone"][0];
break;
case "isa_client_email":
$custom = get_post_custom();
echo $custom["isa_client_email"][0];
break;
case "isa_client_address":
$custom = get_post_custom();
echo $custom["isa_client_address"][0];
break;
}
}
但是,当尝试使用自定义字段值搜索客户端时,我没有得到任何结果