How to write specific HTML code with a specific custom field? [closed]

Try this :

// get_the_ID() will work if you're running within The Loop.
$fieldA = get_post_meta( get_the_ID(), 'name_of_fieldA', true );
$fieldB = get_post_meta( get_the_ID(), 'name_of_fieldB', true );

if( $fieldA ) {
    echo "<a href="".$fieldA."" target="_blank" class="btn btn-primary fb-event"></a>";
}
if( $fieldB ) {
    echo "<a href="".$fieldB."" target="_blank" class="btn btn-primary ra-event"></a>";
}