1 comment

  1. Updated

        <?php global $post;
        $address_name = str_replace(
            ',', 
            '',
             get_post_meta( $post->ID, '_mfl_entry_address_name', true )
        );
    
        $address_street = str_replace(
            ',', 
            '',
             get_post_meta( $post->ID, '_mfl_entry_address_street', true )
        );
    
        $address_line_2 = str_replace(
            ',', 
            '',
             get_post_meta( $post->ID, '_mfl_entry_address_line_2', true )
        );
    
        $address_line_3 = str_replace(
            ',', 
            '',
             get_post_meta( $post->ID, '_mfl_entry_address_line_3', true )
        );
    
        $address_postcode = str_replace(
            ',', 
            '',
             get_post_meta( $post->ID, '_mfl_entry_address_postcode', true )
        );
    
        $full_address = array(
            $address_name, 
            $address_street, 
            $address_line_2,
            $address_line_3,
            $address_postcode
        );
    
        $output = '';
        $glue = ',';
        foreach($full_address as $value){
            if(!empty($value)){
                $output .= $value.$glue;
            }
        }
        $output = trim($output, $glue);
    
        echo $output;
        ?>
    

    Let me know if that works.

Comments are closed.