-
Notifications
You must be signed in to change notification settings - Fork 9
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
Can't enqueue scripts when using a module as a plugin #34
Comments
I'm shure thats a horrible idea. ;). I can recall that we have had some issues before with this in some enviroments. The styles are registrered on the module __construct. This may be too early or too late, depending on when you invoke "modularity_register_module" in your plugin. You should hook your registration of the module on the hook "Modularity" (not plugins_loaded). Do you have some code that produces this error? |
😄 Yes, here's the plugin repo: https://github.com/RegionHalland/mod-accordion Thanks for the quick reply! |
Seems to be a core issue. The module construct is called to late. The module call happends in content-context where styles already has been printed to the page. I will have a go on restructuring the calls to provide the functionality. |
In contradiction to above; I can actually get this working. The styles & css is enqueued correctly on the page that the module appears on (in other words not all pages). What version are you running of Modularity? |
Strange! I'm using version 1.6.5. I've applied the changes from this pull request, but even with a fresh install of Modularity I can't get it to work. What theme were you using when you got this working..? We're using a modified version of Sage. |
Latest release is 2.3.51, do you have the ability to update? We are using latest version of Municipio. |
Updated to 2.3.51, having the same issue. I will look further into this and try to get back with more ideas on what might cause it. Meanwhile, the theme we're using can be found here. Thanks! |
Hi!
I'm creating a plugin for Modularity and want to enqueue a script. I'm using the
script()
method like this:I can only get this working by re-invoking
wp_enqueue_scripts()
on line 140 ofmodularity/source/php/Module.php
, which I assume is a horrible idea:Am I missing something?
Thanks!
The text was updated successfully, but these errors were encountered: