• 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' ) . 'https://salvemosvidas.com/wp-content/uploads/2020/01/arr.png';
                break;
    
                case 'limpieza':
                    $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'https://salvemosvidas.com/wp-content/uploads/2020/01/lim.png';
                break;
    
                case 'semaforos':
                    $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'https://salvemosvidas.com/wp-content/uploads/2020/01/sem.png';
                break;
    
                default:
                    $iconURL = get_bloginfo( 'stylesheet_directory' ) . 'https://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 to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ian Dunn

    (@iandunn)

    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
    https://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 5 years, 2 months ago by Ian Dunn.
    • This reply was modified 5 years, 2 months ago by Ian Dunn.
    Thread Starter matimediza

    (@matimediza)

    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' ) . 'https://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

    (@matimediza)

    ooook i found the problem get_bloginfo( 'stylesheet_directory' ) this renders the adress alll the way to theme file https://salvemosvidas.com/wp-content/themes/twentynine in my case, plus the whole https://salvemosvidas.com/wp-content/uploads/2020/01/arr.png icon’s adress so the code render this:
    https://salvemosvidas.com/wp-content/themes/twentyninehttps://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.