Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Offering some functionality from the extension via a shortcode.

Open themesmeta opened this issue 11 years ago • 2 comments

Hi there, I'm developing a custom extension and I want to offer some functionality from it via a shortcode. My problem is: I have to enqueue some css and js files in front-end when I use shortcode. But in some pages (or posts), I don't need this shortcode, thus I don't need to load css and js files too. How can I detect whether a page is using this shortcode or not ? Hope this makes sense. Any helps would be appreciated. Thanks.

themesmeta avatar Mar 16 '15 12:03 themesmeta

@RayNguyen Your css and js files will be loaded if post content has your shortcode. You can enqueue your assets from static.php file. you can locate it in your shortcode folder or create if not exists.

lgabeskiria avatar Mar 16 '15 13:03 lgabeskiria

Thank you very much for your response @levan1993 . I just get solution for this issue :+1:

themesmeta avatar Mar 16 '15 13:03 themesmeta