WordPress.org

Forums

NextCellent Gallery - NextGEN Legacy
CSS into a separate gallery? (16 posts)

  1. VesaT
    Member
    Posted 1 year ago #

    One of the features of NextCellent Gallery is the ability to edit CSS in one single file, which is fine. What seems to be lacking is an upgrade-safe location for the CSS file; currently the only location besides pluging folders seems to be to put nggallery.css into your theme folder.

    But themes like plugins are upgraded quite often at it would be great to have a possibility to save nggallery.css into a separate upgrade-safe folder.

    Has anyone yet found a way to make this happen? If not, then just put this on the wishlist for future features :)

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

  2. niknetniko
    Member
    Posted 1 year ago #

    Normally themes shouldn't include a nggallery.css file, so it should be upgrade proof.

  3. VesaT
    Member
    Posted 1 year ago #

    @niknetniko:
    To make you galleries look different of what NextGEN (and now NextCellent Gallery) provides as default, you need to manually edit CSS through nggallery.css which by default is in NGG's own /css subfolder.

    In order to make your edits upgrade-safe for NextCellent Gallery upgrades the 'traditional' way has been to locate this edited nggallery.css into your theme's folder.

    If you upgrade your theme, the normal way is to erase the whole theme folder first and the install the new version. This means your edited nggallery.css will be erased as well.

    So an upgrade-safe method is to locate nggallery.css into some folder which is independent of both plugins and themes - this is what NextGEN Gallery 2.0.x currently does By saving the edited css into .../wp-content/ngg-styles folder.

    To repeat my question: has anyone found a way to 'hack' NextCellent Gallery code in a way to enable your edited nggallery.css to be located into somewhere else than plugin or theme folders? Current NextCellent version does not directly support this.

  4. niknetniko
    Member
    Posted 1 year ago #

    Mmmh, I see now.

    Would using a child theme be an option, or are you really looking for the same implementation as in NextGEN 2.0?

  5. VesaT
    Member
    Posted 1 year ago #

    A child theme might be an option which I haven't really tested with this in mind. So far my tests with child themes have not been very convincing especially with self-made themes that I prefer.

  6. niknetniko
    Member
    Posted 1 year ago #

    So, moving the css file to the theme root folder would solve it all, wouldn't it?

    That way, there aren't folders created (like in NGG 2.0) and it doesn't get erased when you update the plugin and/or the theme. The style is still located in the root theme folder then also.

    This would be fairly easy to implement. It's just changing some variables from /blabla/wp-content/themes/theme-name/nggallery.css to /blabla/wp-content/themes/nggallery.css.

  7. VesaT
    Member
    Posted 1 year ago #

    Current supported way is to move nggallery.css to theme root folder - and that is not what I'm looking for. I really want to have nggallery.css in a folder outside plugins and themes, since that is the only way to guarantee no plugin or theme updates will delete the edited css. It also makes NGG edits theme-independent.

    I will report back once I locate the piece of code that looks for the edited nggallery.css file :)

  8. niknetniko
    Member
    Posted 1 year ago #

    Yes, that's what I mean. It won't be in your theme folder, but in the folder containing your themes. That way, it's theme independent. You can change themes, update them, delete them, no problem.

  9. VesaT
    Member
    Posted 1 year ago #

    @niknetniko: the idea of putting an edited nggallery.css into /themes/ folder (not your theme's folder) would serve pretty much like NGG's separate css folder.

    But, I just tested this, and it does not work - it works if you put nggallery.css into your theme's folder. A good idea, but needs some code changes within NextCellent Gallery.

  10. niknetniko
    Member
    Posted 1 year ago #

    Oops, ignore this post.

  11. niknetniko
    Member
    Posted 1 year ago #

    Indeed. You can check out my proposal here. (only the two most recent commits)

    This first looks for the css file in the theme directory, then the theme folder (like it does now) and then it uses the default styles.

    It should work, but I need to test some more.

  12. VesaT
    Member
    Posted 1 year ago #

    @niknetniko:

    this is one way to do stylesheet separation from plugin and theme upgrades. Your proposed solution would however work also with a totally separate folder for the edited nggallery.css, e.g. like NextGEN Gallery using ..wp-content/ngg_styles/ folder (with minor code changes).

    But this solution needs to be part of NextCellent Gallery plugin distribution code. Otherwise any coming plugin upgrades will destroy the changed code and you need to edit the updated .PHP files manually, which is at least as big a manual job as updating nggallery.css manually.

    Hope NextCellent Gallery plugin developer will pick this up and put the code as part of the plugin distribution.

  13. niknetniko
    Member
    Posted 1 year ago #

    That's correct. I'll make a pull request, so this way it will go to the plugin code eventually.

    It's also true it works the same way as NextGEN, but I personally prefer not to make another folder in wp-content, just for one file. However, I could include that option as well, if that's what people prefer.

  14. VesaT
    Member
    Posted 1 year ago #

    @niknetniko:

    I briefly tested your hack to locate edited nggallery.css to /themes/ (root) folder using your latest core.php and style.php files from Bitbucket. Unfortunately it did not seem to work, so please test it over again.

    When I returned the original PHP files and put nggallery.css into my theme's folder the CSS edits worked as they should.

    Looking at the code I was wondering about whether all code changes in core.php really are needed and/or done into right places. I'm not a coding expert with WP, PHP and also not in NextCellent Gallery logic so I have no direct proposals to change your code...

  15. niknetniko
    Member
    Posted 1 year ago #

    Mmmh, weird.

    I did some more testing and changed some things around. It passed all testing on my sites.

    If you want to test again, make sure to use these files:

    (right click, save as...)

    The code now searches for a file in this order:

    1. Theme directory (/themes/nggallery.css)
    2. ngg_styles folder (/wp-content/ngg_styles)
    3. Theme folder (/themes/THEME NAME/nggallery.css)
    4. Default styles

    The styles page should now tell you what file you're using, like this:
    https://lh5.googleusercontent.com/-s-6cgysqdmA/U06iZ6HiT-I/AAAAAAABH74/sYWju9IxjAE/w504-h85-no/root.PNG

    Finally, make sure to press Ctrl + F5 after changing the files, to empty the browser cache.

  16. VesaT
    Member
    Posted 1 year ago #

    @niknetniko: Thanks, now it seems to work (under WP 4.0-alpha) at my local test site :)

    Hope this piece of code will be included in the next public version of NextCellent!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic