reduxframework / redux-framework-4

Redux v4
https://redux.io/redux-4/
Other
97 stars 32 forks source link

Theme Options CSS and JS file URL issue when embedded in a theme #151

Open bryanpaulmiller opened 4 years ago

bryanpaulmiller commented 4 years ago

I embed Redux Framework 4.1.17 in a theme. When I visit the Theme Options page the file URLs to CSS and JS assets are incorrect. They include extra path information instead of only the URL of my website theme.

Is there something I'm doing wrong that could cause this issue? Or, is the free version not able to be embedded in a theme?

Support Hash

Unable to follow link to the support hash page. Link has expired.

Steps to reproduce

Embed Redux Framework 4.1.17 in a theme. Do not install Redux Framework as a plugin. Then visit the Theme Options page.

Expected Behavior

I expect the file URLs to CSS and JS to point to my theme folder.

For example: https://domain.com/wp-content/themes/sample-theme/redux-framework/redux-core/inc/fields/slides/redux-slides.css?ver=4.1.16.1598631244

Actual Behavior

The file URLs to CSS and JS assets are incorrect. They include extra path information instead of only the URL of my website theme.

For example: https://domain.com/wp-content/plugins/var/www/vhosts/domain.com/httpdocs/wp-content/themes/sample-theme/redux-framework/redux-core/inc/fields/slides/redux-slides.css?ver=4.1.16.1598631244

Any Error Details (PHP/JavaScript)

Refused to apply style from 'https://domain.com/wp-content/plugins/var/www/vhosts/domain.com/httpdocs/wp-content/themes/sample-theme/redux-framework/redux-core/assets/css/colors/fresh/colors.css?ver=4.1.17.1598636630' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

kmob2 commented 4 years ago

I second this. Redux Framework 4 in its current state cannot be integrated into a theme. I had redux 3.x directly integrated into my theme for years. Now I upgraded to redux framework 4 and I get the same issues. All css and js files use the wrong path. They use the absolute server path to the files instead of the the theme directory.

Chrome console shows 38 error messages for not being able to include the .js and .css files

It tries to load https://example.com/wp-content/plugins/srv/users/example-site/public_html/wp-content/themes/mytheme/redux-framework-4/redux-core/inc/fields/switch/redux-switch.min.js?ver=4.1.21

Instead of https://example.com/wp-content/plugins/themes/mytheme/redux-framework-4/redux-core/inc/fields/switch/redux-switch.min.js?ver=4.1.21

lacoste-sochi commented 4 years ago

image

Request URL: https://grace-calipso.ru/wp-content/plugins/var/www/grace-calipso.ru/wp-content/themes/Grace%20Group/redux-framework-4/redux-core/assets/js/vendor/qtip/qtip.min.js?ver=2.2.0

The situation is the same ...

I understand it needs to be finalized - Redux_Core::$url

Everything worked fine on OPENSERVER , but doesn't work on linux ubuntu server =(

Help

clstech commented 3 years ago

I also encountered this problem, and it was very troublesome. I used xampp to build it locally, but it was the same when using bt.cn to deploy on CentOS8.0. The resource file path was wrong.

dovy commented 3 years ago

I'm working on it. Trying to root out the cause. For now use TGM to install the plugin. :)

STV11C commented 3 years ago

Hey all, I also just tried now to embed the latest plugin version redux-core folder into my theme. I am getting a similar error but slightly diff. See attached image.

Capture

udarts commented 3 years ago

I did some digging and found the following line:

self::$url       = trailingslashit( dirname( $theme_info['url'] ) );

That is in the class-redux-core.php file.

I tested with:

print_r($theme_info['url']);    /// {my-theme/inc/admin/redux-core/}
self::$url       = trailingslashit( dirname( $theme_info['url'] ) );
print_r(self::$url);     //// {my-theme/inc/admin/}

And it seems the dirname is somehow removing the last part of the url (at least for me), as I added the redux-core folder in the {my-theme/inc/admin/}, so it becomes {my-theme/inc/admin/redux-core/}.

shamloo commented 3 years ago

to fix just add another dir to your core folder e.g if your current Redux dir be: /lib/ make it: /lib/sub/