Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content

I’m currently making a theme that uses admin-ajax.php to dynamicaly load pages and posts.
Some of this content uses plugins like final tiles gallery and Video Embed & Thumbnail Generator. If theses plugins are not used in the php generated page, the corresponding stylesheets and scripts will not be included in the head and footer. Making my dynamicaly loaded elements display and interact inproperly.

I couldn’t find a clean way to make sure every dependency i’ll need is included in the static page.

My solution right now is to add a do_shortcode(‘[KGVID][/KGVID]’); whose result isn’t displayed.
For final tiles gallery the shortcode hack isn’t enough, so I added dependencies in my register_script();

Thanks for your help.

Read more here:: Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content

Leave a Reply

Your email address will not be published. Required fields are marked *