mustardBees / cmb_field_map

Google Maps field type for Custom Metaboxes and Fields for WordPress
120 stars 49 forks source link

How to embed plugin inside theme folder? #29

Closed apokyro closed 9 years ago

apokyro commented 9 years ago

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

mustardBees commented 9 years ago

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.

apokyro commented 9 years ago

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

Thank you!