Offering some functionality from the extension via a shortcode.
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.
@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.
Thank you very much for your response @levan1993 . I just get solution for this issue :+1: