Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading scripts on localhost #118

Closed
ghost opened this issue Dec 14, 2014 · 8 comments
Closed

Loading scripts on localhost #118

ghost opened this issue Dec 14, 2014 · 8 comments

Comments

@ghost
Copy link

ghost commented Dec 14, 2014

Hi guys, I had a problem with loading scripts on localhost, and I modified the code a little then it works. I think I should let you know about my issue.

On the file CMB2_hookup.php

Changed the commented code to uncommented code.

//wp_register_style( 'cmb2-styles', cmb2_utils()->url( "css/cmb2{$min}.css" ), $styles );
wp_register_style( 'cmb2-styles',get_template_directory_uri()."/inc/cmb2/css/cmb2{$min}.css", $styles );

Before I making changes, scripts were loading like this
src="http://website.com/D:\workspace\projects\myproject\file.js"

Thanks

@jtsternberg
Copy link
Member

Sounds like you're on windows, and this condition is not being met:
https://github.com/WebDevStudios/CMB2/blob/master/includes/CMB2_Utils.php#L106

Can you do me a favor and place this at the top of your functions.php and let me know what it gives you?

wp_die( '<xmp>PHP_OS: '. print_r( PHP_OS, true ) .'</xmp>' );

@ghost
Copy link
Author

ghost commented Dec 14, 2014

Yes, I am on wndows. And already fixed my issue.
Your code returns this output:
PHP_OS: WINNT
Thanks

@AlchemyUnited
Copy link
Contributor

I'm having the same issue. Yes, Win 7. ServerPress 3.6.5. Looks like cmb2_utils()->url is busted. I think I upgraded CMB2 and WP around the same notice before noticing this. That is, I'm not sure if it's WP core or some new update to CMB2.

p.s. I'm curious, what does cmb2_utils() do that WP doesn't already offer? I presume it somehow detects how CMB2 is being used / where it's installed, correct?

@pmgarman
Copy link
Contributor

Testing in IIS7.5 everything is working as expected. Going to test further with Apache on Windows to see if that breaks it somehow.

@tnorthcutt
Copy link

Closing as this is over a year old.

@alanef
Copy link

alanef commented Jan 6, 2017

I get this issue developing on XAMPP - PHP_OS: WINNT

Able to fix it on dev using

add_filter( 'cmb2_meta_box_url', 'filter_cmb2_meta_box_url', 10, 2 ); 
function filter_cmb2_meta_box_url( $cmb2_url, $cmb2_version ) { 
        return "/wp-content/plugins/my-plugin-name/admin/CMB2/";
}

But would be nice not to

@tw2113
Copy link
Contributor

tw2113 commented Jan 6, 2017

@alanef
Copy link

alanef commented Jan 9, 2017

Thank - the str_replace is a good idea. Its a Windows mklink that caused the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants