How to change the place types markers on the map?


You may need to change the place types markers so each type can be displayed as a csutom & uniq icon. To allow that, the plugin provides a hook that you can use to change the default marker icons.

  1. Open the plugin folder (“nearby-map”) on your computer.
  2.  Within, you’ll find a folder named “img”. Open that folder.
  3.  Copy the folder “place_types_markers” in your computer. This folder contains all the default marker icons. If you open this folder, you’ll find that all the icons looks the same but they have different names. Each icon represents a place type, for example, the icon “airport” will be used when a user chooses to display the nearby airports to a post or their location.
  4.  Replace the default icon(s) with your custom icon(s) in the folder you just copied in your computer. Please note that you MUST save your new icon(s) with the same name of the default icon(s), otherwise, the default icon(s) will be displayed on the map instead!
  5. Once you’re done replacing the default icons, upload your folder somewhere in your server. Please note that you MUST NOT change the folder name (“place_types_markers”)!
  6. Open your theme’s file “functions.php”, copy and paste the following code:
function csnm_replace_place_types_markers($default_icons_folder){
  
  /**
   * Replace "THE_URL_TO_YOUR_FOLDER" by the full URL to ...
   * your custom icons folder in your server.
   * e.g. "http://yourwebsite.com/images/place_types_markers/"   */

  $custom_icons_folder = "THE_URL_TO_YOUR_FOLDER";
    
  $handle = @fopen($custom_icons_folder, 'r');
  
  if(!$handle)
     return $default_icons_folder;
  else return trailingslashit($custom_icons_folder);

}
add_filter('csnm_place_markers_file', 'csnm_replace_place_types_markers', 10, 1);

Hint: Try to clear your browser’s & server’s caches if you don’t see any changes!


In the same context