sprouter-nate
7/23/2019 - 2:52 PM

SHORTCODE: Display TYPES address field into 2 lines

// Shortcode to strip out everything past address from maps field
// 'location-address' needs to change to the field's slug you are separating into 2 lines
function display_types_address_into_2_lines(){
    $maps_address = types_render_field("location-address", array());
    list($address_line, $localities) = explode(',', $maps_address, 2);
    return $address_line."<br />\n".$localities;
}
add_shortcode( 'display-types-address-as-2-lines', 'display_types_address_into_2_lines' );

/*
 * Usage:  [display-types-address-as-2-lines]
 * Output: breaks up the address stored as a single line of the CPT 'Locations', fieldname "location-address" of Toolset Type's Custom Field -address type- into 2 lines;  address_line and localities
*/