In this tutorial, you’ll see how to add custom class names to the infoboxes.
Edit the file “functions.php” of your theme/child theme and copy/paste one of the exemplary codes below, then, adapt it to your needs:
$default_content:
The default infobox content .
$atts:
Array that contains the map ID as $map_id
and the post ID as $post_id
.
Example 1: Adding simple class names to the inofboxes.
add_filter('cspm_infobox_custom_class', function($default, $atts){
return 'my_custom_class1 my_custom_class2;
}, 10, 2);
Example 2: Using the post terms as new custom class names of the infoboxes.
add_filter('cspm_infobox_custom_class', function($default, $atts){
extract(wp_parse_args($atts)); // Returns "map ID" as $map_id & "post ID" as $post_id
return strip_tags( implode(' ', wp_get_post_terms($post_id, 'category', array('fields' => 'slugs'))));
}, 10, 2);
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 “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”
- Use the StreetView image as the carousel items image
- Hide the Points of Interest from the map
- Import/Export your maps between WordPress websites
- Import/Export your map locations between WordPress websites