Leave a Reply

1 comment

  1. I would simply filter the_title so that it outputs the appropriate custom-field data for your custom post type:

    <?php
    function theme_slug_filter_the_title( $title ) {
        global $post;
        if ( 'employee' == get_post_type( $post ) ) {
            $custom = ( get_post_custom( $post->ID ) ? get_post_custom( $post->ID ) : false );
            $custom_title = ( isset( $custom['name'][0] ) ? $custom['name'][0] : '(Name Not Entered)' );
            return $custom_title;
        } else {
            return $title;
        }
    }
    add_filter( 'the_title', 'theme_slug_filter_the_title' );
    ?>
    

    This will replace the post title with the value for custom field “name” for your custom post type. If no “name” is entered, it returns “(Name Not Entered)”.

    (Of course, you’ll need to replace the values for get_post_type() and $custom['name'], as appropriate.)