I have a short code that is adding a form to a page. How do I ensure that the CSS for the form is loaded in time with the shortcode?
Leave a Reply
You must be logged in to post a comment.
I have a short code that is adding a form to a page. How do I ensure that the CSS for the form is loaded in time with the shortcode?
You must be logged in to post a comment.
you can check with
the_posts
hook if your shortcode exists and only enqueue the style if so :You add the css for this form to your theme’s style.css. The css is already there no matter if you have a form or not. That’s the easiest solution.
You can also embed your styles through a tag above the short code HTMl.