'', 'place_lng' => '', 'place_label' => '', 'radius_km' => 20, 'activity_types' => '', 'limit' => 3, 'columns' => 3, 'link_version' => 'default', ); // Appearance controls (style preset + grouped Show toggles + Advanced raw // flags) default to 'auto'/'standard' — see includes/route-card-appearance.php. $defaults['style'] = 'standard'; foreach ( array( 'group_show_photo_or_map', 'group_show_key_stats', 'group_show_badge', 'group_show_description', 'group_show_destinations' ) as $group_key ) { $defaults[ $group_key ] = 'auto'; } if ( function_exists( 'rfcc_route_card_all_raw_flags' ) ) { foreach ( rfcc_route_card_all_raw_flags() as $flag ) { $defaults[ $flag ] = 'auto'; } } $atts = shortcode_atts( $defaults, $atts, 'rfcc_location_preview' ); if ( ! function_exists( 'rfcc_get_routes_within_radius' ) || ! function_exists( 'rfcc_route_card_shortcode_handler' ) ) { return '
' . esc_html__( 'Route Finder location discovery is not available.', 'route-finder' ) . '
'; } $lat = ( $atts['place_lat'] !== '' && is_numeric( $atts['place_lat'] ) ) ? (float) $atts['place_lat'] : null; $lng = ( $atts['place_lng'] !== '' && is_numeric( $atts['place_lng'] ) ) ? (float) $atts['place_lng'] : null; $radius = is_numeric( $atts['radius_km'] ) && (float) $atts['radius_km'] > 0 ? (float) $atts['radius_km'] : 20; $limit = max( 1, absint( $atts['limit'] ) ? absint( $atts['limit'] ) : 3 ); $cols = absint( $atts['columns'] ); if ( $cols < 1 ) { $cols = 1; } elseif ( $cols > 4 ) { $cols = 4; } if ( null === $lat || null === $lng || $lat < -90 || $lat > 90 || $lng < -180 || $lng > 180 ) { return '' . esc_html__( 'No location configured for this Route Finder preview.', 'route-finder' ) . '
'; } $activity_type_names = array(); if ( ! empty( $atts['activity_types'] ) ) { $activity_type_names = array_filter( array_map( 'trim', explode( ',', $atts['activity_types'] ) ) ); } $matches = rfcc_get_routes_within_radius( $lat, $lng, $radius, $activity_type_names ); $matches = array_slice( $matches, 0, $limit ); // Already closest-first. if ( empty( $matches ) ) { return '' . esc_html__( 'No routes found near this location.', 'route-finder' ) . '
'; } $appearance_atts = function_exists( 'rfcc_route_card_resolve_appearance_atts' ) ? rfcc_route_card_resolve_appearance_atts( $atts ) : array(); $cards = ''; foreach ( $matches as $match ) { $card_atts = array_merge( array( 'id' => $match['post_id'], 'width' => '100%', 'link_version' => $atts['link_version'], ), $appearance_atts ); $cards .= '