Support » Plugins » [Plugin: ThickBox] Use <script> tags instead of str_replace

  • G’day,

    The way this plugins grabbing the JS files and using str_replace() is inefficient. It means WordPress is loaded once for each request. This makes the web server do *a lot* more work than is necessary.

    Instead, it would be much more efficient to include the files as static JS/CSS files (no PHP parsing). Then, insert a <style> and <script> tag into the WordPress header on every page.

    Insert this at wp_head:

    <script type="text/javascript">
    var tb_pathToImage = "<URL>loadingAnimation.gif";
    <style type="text/css">
    .TB_overlayMacFFBGHack {background: url(<URL>macFFBgHack.png) repeat;}

    Then take out those lines from the two static files.

    On busy sites, this approach will significantly improve performance.

    Cheers – Callum.

  • The topic ‘[Plugin: ThickBox] Use <script> tags instead of str_replace’ is closed to new replies.