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!
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,