• I’ve worked out the customization of the album templates, but don’t understand where to put my customized *gallery* file so it can be used and not overwritten on upgrade. I’d love to put it in the same themes/mytheme/nggallery/ folder as my custom album file.

    I’ve tweaked the modules/nextgen_basic_gallery/templates/thumbnails/index.php file (considerably), but where should I copy it to (and how should I title it?) so it can be used as the default from now on?

    btw, it’s been a rocky learning curve for me (there really isn’t much accurate documentation for 2.0 yet), but just wanted to say that anyone who has dived into the code will realize this is a major, major, major upgrade and once the dust settles the potential is huge. Thank you! πŸ™‚

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

Viewing 15 replies - 1 through 15 (of 24 total)
  • Yes would also very much like to know this.

    I have created a separate special style sheet and placed it directly in the themes folder. In the main CSS file of my theme, I import the special CSS. In order to override the settings in other style sheets, like NGG, I added !important to everything I wanted to override. This is probably not considered “best practices” but it eliminates the need to edit the default style sheets used by the theme or the plugins like NGG.

    This works for me, but I cannot vouch for its universality. It should be harmless in any case, if it does not work simply remove the line that imports the special CSS and delete the special CSS file itself. Everything should revert back to original.

    Thread Starter johnny_n

    (@johnny_n)

    Hey @acekin, thanks for the advice – but we’re talking about (or I’m talking about) major code changes (php/html) – not just css – to the actual .php gallery template file itself.

    btw, as per @photocrati (you’ll probably get a warning next time you login to your WP site), your stylesheet should be in your /wp-content/ folder (same directory as your themes and plugins). You should create a /ngg-styles/ folder and add your custom stylesheet there – call it nggallery.css. That’s the proper way to do it.

    Modified template files go in that same folder, it’s just with a modified gallery template file it’s not being read properly and there’s no documentation on what to call it to get it to be read… album overrides work fine.

    Thread Starter johnny_n

    (@johnny_n)

    Actually, I should correct myself – template overrides do go in the theme folder, in a folder called /nggallery/… css overrides go outside the theme folder. Go figure.

    Plugin Contributor photocrati

    (@photocrati)

    Once you update to v2.0.7 that folder @johnny_n referred to, should be created automatically under /wp-content. So the full path for the CSS file would be /wp-content/ngg_styles/nggallery.css . Editing can be done through the WordPress dashboard under Gallery >> Other Options > Styles. The file being in that location on the server will be update-proof so you shouldn’t have any risk of losing customizations when updating the plugin or your Theme. We encourage users to make use of the CSS file for customizations but you’re welcome to continue creating templates as well. πŸ™‚

    -Becky

    @johnny_n, @photocrati, the solution I offered is something I have been using for quite some time now and it is not only for NextGEN Gallery. Other plugins at times need stylistic overrides and making changes in separate files was too cumbersome for me. So, I combined all my CSS overrides in a single file, I clearly document each declaration as to what they do. I wanted to keep this file away from any plugin folder since some delete the entire folder before installing a newer version. The idea of keeping it outside the plugin folder is fine, I wish there were a uniform way of doing these on which everyone can agree. But, we need to live with what we have.

    Cemal

    @photocrati, I am still confused where to put the custom gallery template files. I created the directory in wp-content called ngg_styles for the stylesheet and that worked great. I have also made changes to modules/nextgen_basic_gallery/templates/thumbnails/index.php but I want it to be upgrade proof. Do I still add the template override files to the theme/nggallery folder and if so what do I call it now? I used to call it gallery.php for the basic gallery but that does not seem to work.

    Thread Starter johnny_n

    (@johnny_n)

    @rsherman79 if there was an answer to your question it would be here already lol…

    For now I created a backup of the file and added it to the ngg_styles folder so at least I know my changes can be manually updated. The setup of the previous version seemed so much simpler. Was a complete overhaul without any clear alternatives for things like overriding templates really necessary?

    Thread Starter johnny_n

    (@johnny_n)

    Good call. I think this functionality is just not implemented yet (don’t ask me why).

    The album overrides work fine, and there’s a place in the gallery admin to select the overridden template, but no matter what you call it (old naming conventions or new) the admin never sees the new gallery template.

    I had to dig through the code to get something to work right, and it’s pretty cool – once they get it all working and the documentation sorted out. But you’re right, it’s all more complicated now.

    Plugin Contributor photocrati

    (@photocrati)

    @johnny_n, @rsherman79: A couple other quick thoughts (from Erick this time).

    The “template” concept is one that belongs to Legacy (1.9.x). For 2.0 we’re starting to move away from that. But any templates you’ve created should still be honored.

    You should be able to store template files, the same ones you’ve always used, at either of the two locations:

    /wp-content/themes/[theme-folder]/nggallery/
    /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/view/

    Looking at this, we probably need to come up with a better solution similar to ngg_styles, so it’s directly in wp-conent. But for now, both of those should work.

    Thread Starter johnny_n

    (@johnny_n)

    @photocrati – thanks for the reply, but you didn’t really answer our questions. Actually you did, but indirectly.

    We (@rsherman79) have edited the only file in 2.0 we could find to edit:

    modules/nextgen_basic_gallery/templates/thumbnails/index.php

    What I think you’re saying is that actually this isn’t a template file – I’ve noticed there are no comments at the top like old template files.

    If this is the case, then what are we supposed to edit in 2.0 to customize gallery presentation, and how do we get 2.0 to recognize these changes?

    The 2.0 album template I’ve edited works fine – so why is there not an editable gallery template to match? Because of the way nggallery is now setup I have to use php sessions to pass some variables to the gallery from the album. So how am I supposed to do that without an editable gallery template?

    We’re just asking for advice here – we’re looking for an editable 2.0 version of the gallery template that won’t be overwritten. If that doesn’t or won’t exist, then how do we proceed?

    You say you are moving away from templates but to what?

    Thank you!

    @photocrati I would also like to know as a site I maintain have a custom template that stopped working after the upgrade.

    My custom template loads the gallery/image information into a javascript object (so that an ajax like effect can be achieved).

    After the upgrade I realized that the objects and info that is sent to the javascript is no longer in the expected format (it does not contain any paths) and therefore had to disable the template.

    Can I add my voice to the last two @photocrati?

    I use NextGen Custom Fields to allow me to add urls to another website. That was achieved by creating a gallery-customlinks.php file. If I’ve understood what you’ve said above, then I should still be able to use this in the Legacy system. The system that is noted everywhere as being ‘not recommended’. I can only imagine that it isn’t recommended because at some point it won’t be supported and I’m not keen on the idea that my customer’s carefully crafted webpage will just break at some point.

    I too would like to know what you mean when you say you’re moving away from the concept of templates. As johnny_n says – what will this be replaced with?

    @photocrati Adding my voice, too, and seconding NFWRo’s question about moving away from the concept of “templates”–that’s why I chose NextGen to manage galleries!

    I too have written custom php “templates” to manage/display gallery info for a wide array of uses, that aren’t just views–for example, one produces a json feed of gallery image data for use in several places on our site.

    My templates are still in the directory you recommended above (/wp-content/themes/[mytheme]/nggallery), and my shortcodes haven’t changed (somewhere else I saw that ‘legacy’ shortcodes should still be supported?).. however, nothing works, and the only documentation I can find is about the shortcode changes.

    Please help!

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Customizing Gallery Templates – 2.0’ is closed to new replies.