Ideally you should include the code you’ve already tried with your question so we can help with that, just a tip. 🙂 But if you’re using the code from that other post as-is, the change would be to this bit:
add_filter( 'the_title', 'wpse33385_filter_title', 10, 2 );
function wpse33385_filter_title( $title, $post_id )
{
if( $new_title = get_post_meta( $post_id, 'custom_field_name', true ) )
{
return $new_title;
}
return $title;
}
Where the original only references one custom field, you need to grab two and then use both:
add_filter( 'the_title', 'wpse33385_filter_title', 10, 2 );
function wpse33385_filter_title( $title, $post_id )
{
$photos_title = get_post_meta( $post_id, 'dlc_media_photos_titre', true );
$photos_date = get_post_meta( $post_id, 'dlc_media_photos_date', true );
if( $photos_title && $photos_date) {
$new_title = $photos_title . ' ' . $photos_date;
return $new_title;
}
return $title;
}
Note that the line $new_title = $photos_title . ' ' . $photos_date;
is adding a space between the output of the two fields. If you wanted something else there, a | (pipe symbol) for instance, you could do:
$new_title = $photos_title . ' | ' . $photos_date;