Hi Mikko,
Thank you for your message!
Do you have any PHP error message, or some errors in the browser console?
If not, I will check this out on my own to understand what is missing.
Thanks!
Alex
Thread Starter
Mikko
(@sainionmikko)
Hi Alex,
Thanks for your response! Yes, I have error messages! Both in the server log and in the console. It seems the GET method isn’t finding the following files:
/happy-scss-compiler/includes/highlight/styles/ir-black.min.css
/happy-scss-compiler/admin/css/hm-wp-scss-admin.css
/happy-scss-compiler/includes/highlight/highlight.min.js
/happy-scss-compiler/admin/js/hm-wp-scss-admin.js
The path used is definitely wrong. It starts with /wp-content/plugins/ and continues with a full absolute path to my changed plugin directory, something like C:/Users/…/wp-content/themes/my-theme/lib/plugins/happy-scss-compiler/… where the last part is the correct path to where I save and include the plugin in my functions.php. As I wrote earlier, I have moved the plugin away from /wp-content/plugins/ in a subfolder in my theme.
Is there a way to redefine the paths to these asset files for the plugin in some way prior to including the main plugin file?
Thread Starter
Mikko
(@sainionmikko)
Hi Alex,
Meanwhile, I tried to tinker this and hardcoded the style and script enqueue path in the class-hm-wp-scss-admin.php file, lines 88-89 and 112-113. I got rid of the console errors, but the following error persists in the server log and styles&scripts are not loaded:
CreateFile() "C:/Users/me/Local Sites/mysite/app/public/wp-content/plugins/C:/Users/me/Local Sites/mysite/app/public/wp-content/themes/my-theme/lib/plugins/happy-scss-compiler/admin/js/hm-wp-scss-admin.js" failed (123: The filename, directory name, or volume label syntax is incorrect), client: 127.0.0.1, server: , request: "GET /wp-content/plugins/C:/Users/me/Local%20Sites/mysite/app/public/wp-content/themes/my-theme/lib/plugins/happy-scss-compiler/admin/js/hm-wp-scss-admin.js?ver=1.3.10 HTTP/1.0"
Obviously, the path is still wrong somewhere. I’d be grateful if you could point me to the right direction!
Hi there,
Sorry for the delay, it is difficult to find some time these days… I will try to be more reactive.
What you changed in class-hm-wp-scss-admin.php is exactly what you had to do.
Now, I think this error shows that WordPress doesn’t understand that the path you specified has to be relative, not absolute.
Can you show me what you put in place of the previous path?
Thanks!
Alex
Thread Starter
Mikko
(@sainionmikko)
Hi Alex,
I got this working now! I had replaced the original plugin_dir_url(__FILE__) with get_template_directory() + my path to dir. This didn’t work as it produced an absolute path. I then just wrote the whole relative path to my dir starting from /wp-content/ with no preceding functions. This will be my parent theme path and remain the same so it’s OK to hardcode. So it’s solved, thanks for your help!
Hi Mikko,
I am glad it works now! Thanks for sharing me this point, I will take it into account for the future updates.
Have a good day!
Alex