Title: custom markers code doesn´t work
Last modified: January 20, 2020

---

# custom markers code doesn´t work

 *  [matimediza](https://wordpress.org/support/users/matimediza/)
 * (@matimediza)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-markers-code-doesnt-work/)
 * put the code on the theme’s function.php but doesn’t show anything, the markers
   are there but the image is missing
 *     ```
       function setBGMPDefaultIconByCategory( $iconURL, $placemarkID )
       {
           $placemarkCategories = wp_get_object_terms( $placemarkID, 'bgmp-category' );
   
           foreach( $placemarkCategories as $pc )
           {
               switch( $pc->slug )
               {
                   case 'arreglo-calles':
                       $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'http://salvemosvidas.com/wp-content/uploads/2020/01/arr.png';
                   break;
   
                   case 'limpieza':
                       $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'http://salvemosvidas.com/wp-content/uploads/2020/01/lim.png';
                   break;
   
                   case 'semaforos':
                       $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'http://salvemosvidas.com/wp-content/uploads/2020/01/sem.png';
                   break;
   
                   default:
                       $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'http://salvemosvidas.com/wp-content/plugins/basic-google-maps-placemarks/images/default-marker.png';
                   break;
               }
           }
   
           return $iconURL;
       }
       add_filter( 'bgmp_default-icon', 'setBGMPDefaultIconByCategory', 10, 2 );
       ```
   
 * what am i doing wrong?
 * thanks in advance, awesome plugin
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-markers-code-doesnt-work%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Ian Dunn](https://wordpress.org/support/users/iandunn/)
 * (@iandunn)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-markers-code-doesnt-work/#post-12345444)
 * It looks like you theme is producing some JavaScript errors, which you can see
   in your browser’s developer console.
 * > global.js?ver=5.2.3:54 Uncaught ReferenceError: fadeInSpotted is not defined
   > 
   > [http://salvemosvidas.com/wp-content/themes/hamilton/assets/js/global.js?ver=5.2.3](http://salvemosvidas.com/wp-content/themes/hamilton/assets/js/global.js?ver=5.2.3)
 * That may be the cause of the problem. You can verify that by temporarily switching
   to one of the default themes, and seeing if it works there.
 * If that is the problem, I’d contact your theme developer.
 * If it’s not, you could try turning off the Marker Clustering option, and see 
   if that helps.
    -  This reply was modified 6 years, 4 months ago by [Ian Dunn](https://wordpress.org/support/users/iandunn/).
    -  This reply was modified 6 years, 4 months ago by [Ian Dunn](https://wordpress.org/support/users/iandunn/).
 *  Thread Starter [matimediza](https://wordpress.org/support/users/matimediza/)
 * (@matimediza)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-markers-code-doesnt-work/#post-12346239)
 * thanks for responding so quick.
 * so, i change to Twenty Nineteen oficial wordpress theme, those js error are no
   more but the icons are still missing, also turned off the Marker Clustering option.
 * The code i wrote is correct, right?
    this `case 'arreglo-calles'` is the category
   slug, and this `$iconURL = get_bloginfo( 'stylesheet_directory' ) . 'http://salvemosvidas.
   com/wp-content/uploads/2020/01/arr.png';` the full icon adress
 * and the location is in function.php, right?
 * i don`t know what else to do
 * thanks in advance
 *  Thread Starter [matimediza](https://wordpress.org/support/users/matimediza/)
 * (@matimediza)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-markers-code-doesnt-work/#post-12346280)
 * ooook i found the problem `get_bloginfo( 'stylesheet_directory' )` this renders
   the adress alll the way to theme file `http://salvemosvidas.com/wp-content/themes/
   twentynine` in my case, plus the whole `http://salvemosvidas.com/wp-content/uploads/
   2020/01/arr.png` icon’s adress so the code render this:
    `http://salvemosvidas.
   com/wp-content/themes/twentyninehttp://salvemosvidas.com/wp-content/uploads/2020/
   01/arr.png` so i just get up 3 levels with the old buddy `../` and that was all.
   is not pretty but it works
 * thanks for your help

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘custom markers code doesn´t work’ is closed to new replies.

 * ![](https://ps.w.org/basic-google-maps-placemarks/assets/icon-128x128.png?rev
   =1152531)
 * [Basic Google Maps Placemarks](https://wordpress.org/plugins/basic-google-maps-placemarks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/basic-google-maps-placemarks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/basic-google-maps-placemarks/)
 * [Active Topics](https://wordpress.org/support/plugin/basic-google-maps-placemarks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/basic-google-maps-placemarks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/basic-google-maps-placemarks/reviews/)

## Tags

 * [marker](https://wordpress.org/support/topic-tag/marker/)

 * 3 replies
 * 2 participants
 * Last reply from: [matimediza](https://wordpress.org/support/users/matimediza/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/custom-markers-code-doesnt-work/#post-12346280)
 * Status: not resolved