• Resolved ryvix

    (@rrhode)


    Hi there,

    NGG will appear to not load properly, the options pages don’t display, things just won’t work because none of the assets are being loaded. This is because the URLs are to those files look like example.comwp-content and in my case this is due to a conflict between the get_static_url function and a setting in the Roots theme which enables relative URLs.

    I just spent a couple hours or more searching far and wide to figure this out so I thought I would post it here to potentially save the next person who goes on this journey some time. I saw lots of people with a similar issue but no solutions. Here are the solutions.

    Solution 1

    If using the Roots theme comment this line out or remove it from your Roots config.php file:

    add_theme_support('root-relative-urls');

    Solution 2

    If you aren’t using the Roots theme and are having the same issue you may have some other code in your theme or a plugin which does a similar thing. Therefore, if you don’t want to or can’t change that option without breaking other things or you aren’t using the Roots theme and can’t figure out what’s modifying your URLs then you can also modify NGG’s get_static_url function like I’ve shown below.

    Around line 156 of this file in NextGEN Gallery Version 2.1.23
    /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/package.module.mvc.php

    Change:
    return $retval;

    To:

    return ($retval[0] != "/") ? "/" . $retval : $retval;

    Good luck!

    Ryan

    https://wordpress.org/plugins/nextgen-gallery/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @rrhode – Thank you very much for sharing this!! I’ll also have our developers review your ideas here as well for possible inclusion in a future release.

    – Cais.

    Benjamin

    (@benjaminowens)

    Thanks rrhode! I’ve checked in a modified form of your patch.

    Thank you soo soo much @rrhode for saving my life.! Spent so many days to find a fix for this issue.

    Plugin Contributor photocrati

    (@photocrati)

    @nehagrover027 – Which “Solution” did you apply to your site?

    – Cais.

    I’m using a custom theme build on Roots, so I used Solution 1 which is:

    If using the Roots theme comment this line out or remove it from your Roots config.php file:

    add_theme_support(‘root-relative-urls’);

    Plugin Contributor photocrati

    (@photocrati)

    @nehagrover027 – Thanks for the follow-up!

    – Cais.

    Thank you! This worked flawlessly.

    Plugin Contributor photocrati

    (@photocrati)

    @arudd – Thanks for sharing!

    – Cais.

    After going back to the site and testing again, I realize this hasn’t fixed my issue.
    When I click on the Pagination, it breaks the album and removes it completely.
    Additionally, changing:

    Around line 156 of this file in NextGEN Gallery Version 2.1.23
    /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/mvc/package.module.mvc.php

    return $retval;

    To:

    return ($retval[0] != “/”) ? “/” . $retval : $retval;

    Didn’t work either.
    Unfortunately, my site is login only and cannot be accessed publically.

    Plugin Contributor photocrati

    (@photocrati)

    @arudd – Please send us a Bug Report (https://imagely.com/report-bug/ … please reference this topic) so we can get a better look under the page at your site.

    Please include as many details as you can about your site and the issue at hand so we can move on this as fast as possible.

    Thanks!

    – Cais.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Solutions to missing leading slash in URLs’ is closed to new replies.