Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Hi!
Im making my own modules to page builder.
It is possible to load CSS in footer like JS files?
Im trying to find this in plugin sorce code, but I can’t found.
It is possible to set globaly for all widgets?
function initialize() { $this->register_frontend_scripts( array( array( $this->so_plugin_slug, $this->so_plugin_url . 'tpl/script.js', array('jquery'), self::SO_PLUGIN_VER, true // add to fotter ), ) ); $this->register_frontend_styles( array( array($this->so_plugin_slug, $this->so_plugin_url . 'tpl/main.min.css', array(), self::SO_PLUGIN_VER), ) ); }
Hi,
register_frontend_styles is a helper function for wp_enqueue_style. This function doesn’t work in the same way as wp_enqueue_script so it’s not possible to tell WordPress to output the script to the footer when registering them.
You could override enqueue_frontend_scripts and hook into wp_footer and output your CSS there. You’ll need to do this for each widget however as this method – and related styling – is widget specific.
Kind regards,
Alex
hmm something like this in my widget?
Hi Fpweb,
I recommend using wp_footer instead of get_footer. You add a hook for get_footer and then use $this->enqueue_registered_styles( $instance).
Kind regards,
Alex