# How to include assets properly (plugin)

**URL:** <https://forum.pinegrow.com/t/how-to-include-assets-properly-plugin/6767>\
**Category:** Pinegrow WP\
**Created:** [August 6, 2022, 9:28am UTC](https://forum.pinegrow.com/t/how-to-include-assets-properly-plugin/6767 "2022-08-06T09:28:59Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Wolfgang.Hartl](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/wolfgang.hartl/32/4621_2.png) [@Wolfgang.Hartl](https://forum.pinegrow.com/u/Wolfgang.Hartl)\
**Post date:** [August 6, 2022, 6:48pm UTC](https://forum.pinegrow.com/t/how-to-include-assets-properly-plugin/6767/6 "2022-08-06T18:48:28Z")

</div>

Just one more question @matjaz . I just recognized that the javascript file get’s enqueued in the header (without passing the argument for it).

Although I can optimize that using an optimization plugin which moves the javascript to the footer again I would prefer to have either the option to select where to load it or to load it before the tag by default.

I’ve adapted the code, basically all you need to change is passing that last parameter in wp\_enqueue\_script() ($in\_footer) with a Boolean-Value of True!

 ![Bildschirmfoto 2022-08-06 um 20.41.42](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/f/f403331524bc78fad84fe6d054200fc47656b643.png)

Another Approach would be to include enqueue scripts into the render\_callback argument of the register\_block\_type function (found here: [wp enqueue script - Load CSS/Javascript in frontend conditionally if block is used - WordPress Development Stack Exchange](https://wordpress.stackexchange.com/questions/328536/load-css-javascript-in-frontend-conditionally-if-block-is-used)). That would theoretically solve the limitation of only one js and one css file for every block (in 99.99999% of all cases one would be enough for a block I guess, but just wanted to point that out too) 😃

I did a quick test and it didn’t work in first place, so maybe that doesn’t work anymore but probably I did something wrong!

And last but not least, is there a possibility to also get that `'editor-script'` argument? I’ve also tested that and it worked for me when using the same script, if using another script you would probably have to run through the register\_script process again and you would need to implement a control inside of pinegrow. That’s nothing which I consider as too important but I think it would be cool to have the ability to write the javascript also for the gutenberg-editor so you get a more live-editing experience! Maybe for any future update? 🙂

---

_[View the full topic](https://forum.pinegrow.com/t/how-to-include-assets-properly-plugin/6767)._
