• Retina.js client side won’t work for me even when selected in the settings unless I also add

    <script type="text/javascript" src="/wp-content/plugins/wp-retina-2x/js/retina.js"></script>

    to my header. Once this is present in header, client side works fine.

    Also, debug mode fails to force retina graphics.

    Thoughts?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    If you don’t add the script manually, you cannot see it being added automatically?

    Are you using a very custom theme? (that you did yourself)

    Is the wp_head() function called in your theme? (WP themes must call this function in the header).

    Debug mode also inject code through wp_head().

    Thread Starter summitsips

    (@summitsips)

    That’s right. If I don’t add it manually as a header insert, the plugin won’t add it automatically.

    I am using a pretty popular theme: Atahualpa. Everything is up to date with latest releases.

    I found wp_head() is called within my theme’s headers.php and I see that in the header there are other plugin scripts present such as Google Analyticator.

    I’ve tried removing and reinstalling WP Retina 2x and that hasn’t worked. Any way I can see if somewhere the script is being deregistered?

    Thread Starter summitsips

    (@summitsips)

    Are you sure you are loading retina.js in the header?

    I may have found the source of my problem, but it’s the footer, not the header at fault.

    My site wasn’t loading the wp_footer() for some reason. My theme has settings to configure the footer that may have appeared in a recent theme update. I had to enable a theme option to ‘display queries’–a debug option–in my footer settings, and when I did that, my footer started to display. I turned this setting back off again and the footer remains.

    Then, I noticed in the source code that with my footer loading, there’s now a call to the retina.js script. It seems that the client side script loads from the footer. Is that right? Would it start replacing images with 2x if it were loading in the header? Should it be in the header as you thought or doesn’t it matter?

    Plugin Author Jordy Meow

    (@tigroumeow)

    You are right, the script is added in the footer.

    wp_enqueue_script( ‘retinajs’, plugins_url( ‘/js/retina.js’, __FILE__ ), array(), $wr2x_retinajs, true );

    The last argument indicates that it will be in the footer.

    It’s fine that the script is loaded at the end, it’s better for the website performance. However, if you theme doesn’t use it, then you should either add it manually in the theme or change that argument in the plugin code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Client side not working without loading retina.js in header’ is closed to new replies.