Conditionally Loading JavaScript/CSS for Shortcodes

Posted by Prem Tiwari | Updated on

Based on my own experience, I’ve used a combination of method 1 & 2 – the architecture and footer scripts of 1, and the ‘look-ahead’ technique of 2.

For the look-ahead though, I use regex in place of stripos; personal preference, faster, and can check for ‘malformed’ shortcode;

For the lazy author who never RTFM, output a message to highlight the error of their ways 😉

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers