mustardBees/cmb_field_map

How to embed plugin inside theme folder?

Closed this issue · 2 comments

Hi, great plugin.

Is there any way to embed this plugin inside theme folder?
In functions.php I try to add this:
require get_template_directory() . '/cmb-field-map/cmb-field-map.php';
and put the folder inside theme directory but the map doesn't work. I only saw the input field (it's not working if I type something).

Is it possible to add the plugin folder inside theme folder and call it from functions.php? Just like CMB2.

Thanks in advance

Hi there. It should be possible to include the field within your theme. You'll need to modify these two lines to reference the correct directory. Try something like:

wp_enqueue_script( 'pw-google-maps', get_stylesheet_directory_uri() . '/cmb-field-map/js/script.js', array( 'pw-google-maps-api' ), self::VERSION );
wp_enqueue_style( 'pw-google-maps', get_stylesheet_directory_uri() . '/cmb-field-map/css/style.css', array(), self::VERSION );

As per @kalicki's suggestion in #28, this should be easier in the future. I plan on adding a filter to allow overriding the directory without modifying the field.

That was fast!
I did that and works fine. I am looking forward for the update.

Thank you!