To use the StreetView image of your locations as the carousel items image, do the following:
Important! Please read the Street View Static API Usage and Billing before using this option.
- Go to your Google API Console and make sure to activate the API “Street View Static API”
- Edit the file “functions.php” of your theme/child theme and copy/paste the following PHP code in it:
For more info about the StreetView image URL parameters, visit the developer guide.
/**
* Use StreetView image as the carousel items image */
function cspm_street_view_post_thumb($default_thumb, $post_id, $width, $height){
if(!class_exists('CSProgressMap'))
return;
$CSProgressMap = CSProgressMap::this();
$post_thumbnail = $default_thumb;
$latitude = get_post_meta($post_id, CSPM_LATITUDE_FIELD, true);
$longitude = get_post_meta($post_id, CSPM_LONGITUDE_FIELD, true);
$location = $latitude.','.$longitude;
$size = $width.'x'.$height;
$API_key = $CSProgressMap->api_key;
$heading = 0;
$fav = 0;
$pitch = 0;
$URL = 'https://maps.googleapis.com/maps/api/streetview?size='.$size.'&location='.$location.'&heading='.$heading.'&pitch='.$pitch.'&key='.$API_key;
if(!empty($latitude) && !empty($longitude) && !empty($API_key))
$post_thumbnail = '<img src="'.$URL.'" />';
return $post_thumbnail;
}
add_filter('cspm_post_thumb', 'cspm_street_view_post_thumb', 10, 4);
In the same context
- Open the single post page inside a modal
- Programmatically change single map language based on the URL’s language attribute
- Synchronize the ACF map field with the map fields in “Progress Map”
- Set the zIndex of a specific marker
- Replace/override your map query settings to showcase diverse locations on any page
- Show locations based on a keyword search
- Display “Progress Map” metabox on “Envira Gallery” add/edit page
- How to add custom class names to the infoboxes
- How to add “Read More” link to the infobox content
- Programmatically change the content of the carousel items
- Programmatically change the content of the infobox
- Programmatically change the title of the infobox
- Make the plugin GDPR/DSGVO compliance
- Trigger marker events
- Center the map on a specific marker on page load
- Open the locations/posts “Nearby places” map inside a modal
- Redirect to the single post on marker click
- Insert a map inside a taxonomy page and display locations based on the current taxonomy term
- Use marker popups to display the post ID
- Change the text of the button “Toggle Carousel”
- Hide the Points of Interest from the map
- Import/Export your maps between WordPress websites
- Import/Export your map locations between WordPress websites