WordPress.org

Ready to get started?Download WordPress

Forums

Thickbox problem and solution (7 posts)

  1. happypwc
    Member
    Posted 5 years ago #

    I get all errors (404) and the like via logging and I noticed alot of thickbox errors.

    It occurs when and if a link is outside the main directory. including author, category, tags, pages etc.

    Might want to change it on the next SVN. REmove the .. (double dots). I did and the errors occur no more. The issue at hand is even a minor like this one causes enough error to add 2 or 3 or more seconds to your load time and produces errors that may flag your site in search results not to mention a reason why he pix i needed any who.

    at line 8 nd 9
    var tb_pathToImage = "../wp-includes/js/thickbox/loadingAnimation.gif";
    var tb_closeImage = "../wp-includes/js/thickbox/tb-close.png";

    to
    var tb_pathToImage = "/wp-includes/js/thickbox/loadingAnimation.gif";
    var tb_closeImage = "/wp-includes/js/thickbox/tb-close.png";

  2. dereklerner
    Member
    Posted 5 years ago #

    Thanks this was helpful.

  3. stefing
    Member
    Posted 5 years ago #

    Hi Happypwc,
    Can you explain further, which file do I need to modify to solve a similar problem like yours?

    Best regards,
    stef

  4. lexhair
    Member
    Posted 5 years ago #

    This solution only works when WordPress is in the root directory.

  5. paulzag
    Member
    Posted 5 years ago #

    The file to edit is wp-includes/js/thickbox/thickbox.js

  6. mlewitz
    Member
    Posted 5 years ago #

    Another, simpler option using .htaccess...

    I did this fix (above), then when the recent WP update came out, it wrote over my modified .js file. Not a big deal, but I have several blogs on this server. (actually, for some reason I had to use a full URL to fix it, like: http://www.mydomain.com/blog/wp-includes/js/thickbox/loadingAnimationlgif)

    I was disappointed this recent updated didn't fix this problem.

    Anyway, here is the code I placed into my .htaccess file (in the root directory of my domain). It's just 1 line and works perfect! Should work for nearly all common Apache configurations that allow .htaccess files.

    Make sure it's all on THE SAME LINE!!! (this forum wraps the text).

    Redirect 301 /wp-includes/js/thickbox/loadingAnimation.gif http://www.MYDOMAIN.com/blog/wp-includes/js/thickbox/loadingAnimation.gif

    I feel this is better for another reason:
    My expires tag is set into the future, so visitors who have cached the .js file will never get the "corrected" version. So, adding this line into the .htaccess fixes the problem for cached versions, too.

    Hope this helps everyone!
    Enjoy!

  7. guvilla
    Member
    Posted 5 years ago #

    I do different and more flexible.
    Just add the following lines into your theme header.php after wp_header();

    <script>
    var tb_pathToImage = "<?php bloginfo('url'); ?>/wp-includes/js/thickbox/loadingAnimation.gif";
    var tb_closeImage = "<?php bloginfo('url'); ?>/wp-includes/js/thickbox/tb-close.png";
    </script>

    Example:
    <?php wp_enqueue_script( 'jquery');?>
    <?php wp_head(); ?>
    <script>
    var tb_pathToImage = "<?php bloginfo('url'); ?>/wp-includes/js/thickbox/loadingAnimation.gif";
    var tb_closeImage = "<?php bloginfo('url'); ?>/wp-includes/js/thickbox/tb-close.png";
    </script>
    <body>

    Using this, you won't need to hack your WP core and could keep your installation always fresh. Keep it in mind.
    ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags