• mslaza77

    (@mslaza77)


    Hi!

    I set up the WP Store Locator and I’m trying to get the custom markers to work. I’ve been trying to follow along the instructions but I am unsure where I need to put the new marker and how to really set this up (I am a noobie if you can’t already tell because this should be a basic edit).

    I created the custom marker folder and named it “wpsl-markers” (in my theme folder??). From there I believe I am supposed to put all the code in the functions.php file of my WP theme. Does it matter where I put the code in that file?

    When I ran everything, all the default markers disappear and only my custom ones are populated which is fine but when selected and saved in the settings a preview of the map does not populate any of the markers on the map.

    Here’s the link to the tutorial I used:

    Any help would be appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mslaza77

    (@mslaza77)

    Mainly I’m a little confused as to why all these custom codes need to go into php files in my theme folder as opposed to the plugin folder. I’m definitely misunderstanding how the backend flows together with my WordPress site and the plugins.

    Thank you again for any help!

    farroyo

    (@farroyob)

    Hi there, thanks for writing.

    The fact that these customizations have to go in your active theme’s functions.php file is actually considered WordPress best practices. The reason is that, since what you are customizing is relative to the appearance of the website, it is best if this code is related to the theme in some way, and therefore the functions.php file is precisely made for that.

    If you modified files in the plugins folder, as the plugins get updated you may end up losing those changes, whereas the functions.php file remains in place even when the themes get updated over time.

    So yes, changing the default markers is indeed related to the plugin, but it is conceptually also related to the theme, and that is why it is common practice to have these filters and modifications reside in the functions.php file. This is the same for mostly all plugins out there that offer customizations via code.

    As for your particular issue, if you have created the folder, for example:

    /wp-content/themes/my_theme/wpsl-markers/

    Then you need to add this code snippet in your functions.php file so that the plugin is aware that your theme wants to use these markers:

    add_filter( 'wpsl_admin_marker_dir', 'custom_admin_marker_dir' );
    function custom_admin_marker_dir() {
        $admin_marker_dir = get_stylesheet_directory() . '/wpsl-markers/';   
        return $admin_marker_dir;
    }
    
    define( 'WPSL_MARKER_URI', dirname( get_bloginfo( 'stylesheet_url') ) . '/wpsl-markers/' );
    

    Please get back if that doesn’t work and we’ll try to figure out what is going on.

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Markers’ is closed to new replies.