WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
Customizing Gallery Templates - 2.0 (25 posts)

  1. johnny_n
    Member
    Posted 11 months ago #

    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/

  2. melmo
    Member
    Posted 11 months ago #

    Yes would also very much like to know this.

  3. acekin
    Member
    Posted 11 months ago #

    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.

  4. johnny_n
    Member
    Posted 11 months ago #

    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.

  5. johnny_n
    Member
    Posted 11 months ago #

    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.

  6. photocrati
    Member
    Plugin Author

    Posted 11 months ago #

    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

  7. acekin
    Member
    Posted 11 months ago #

    @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

  8. rsherman79
    Member
    Posted 11 months ago #

    @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.

  9. johnny_n
    Member
    Posted 11 months ago #

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

  10. rsherman79
    Member
    Posted 11 months ago #

    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?

  11. johnny_n
    Member
    Posted 11 months ago #

    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.

  12. photocrati
    Member
    Plugin Author

    Posted 11 months ago #

    @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.

  13. johnny_n
    Member
    Posted 11 months ago #

    @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!

  14. Jacotheron
    Member
    Posted 11 months ago #

    @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.

  15. NFWRo
    Member
    Posted 10 months ago #

    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?

  16. s_adwill
    Member
    Posted 10 months ago #

    @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!

  17. edanzer
    Member
    Posted 10 months ago #

    Hey all - this is Erick from Photocrati. I just wanted to jump in and respond to the questions from some of you about "if not templates, then what."

    First, I just want to reassure you that when we say we're deprecating templates, it doesn't mean we're going to stop supporting them. Given how popular templates are in the NextGEN ecosystem, I just don't see how we could ever consider that. So our intent is to continue to support the template functionality exactly as it exists now to ensure full backwards compatibility, and compatibility with templates going forward.

    At the same time, we're not going to be investing time to improve or refine the template system. And we are going to be working improving and developing the "module" system that defines much of the logic of NextGEN 2.0. Right now, you can add new gallery types to NG 2.0 using modules and this system is more powerful and flexible. But right now, it's also more complicated than adding a template. So we need to refine the functionality and documentation to make it easier to add new gallery types via modules. We'll know we've done a good job with that when people start using it.

    Until then, you are welcome to continue using templates with the knowledge that we're going to continue to support them.

    -
    Given everything I've said above, your current templates should be working and most templates are working. If they are not, that's an issue or bug we need to address. The best thing you can do is submit a bug report with login credentials. We'd need to see your template and understand why it's not loading correctly.

    http://www.nextgen-gallery.com/report-bug/

  18. edanzer
    Member
    Posted 10 months ago #

    @NFWRo: just one additional note. You mentioned the NG Custom Fields plugin. There may be some separate compatibility issues there affecting your templates until that plugin is updated for full compatibility with NG 2.0.

  19. mellowvision
    Member
    Posted 10 months ago #

    I downloaded and installed next gen and next gen PRO today, got it up and running and then ran into this same problem.

    I followed the instructions to create a nggallery folder in my theme folder and copy over the gallery.php file. Editing this file does not affect anything.

    I've done quite a bit of searching, and can not seem to find clear documentation for implementing template changes for the pro grid album or for the thumbnail grid that displays for pages within the album.

    It's very frustrating, what should be taking me minutes is now stringing into hours. I just want the captions to show and to add a download button with the triggers. This shouldn't take so much research!

  20. NFWRo
    Member
    Posted 10 months ago #

    @photocrati @edanzer
    Thanks for the reassurances. I have to say that in a test environment I have the custom fields plugin working fine with NG 2.0 having amended the index.php in the relevant gallery type. However, this would obviously not be upgrade proof which is what I was looking for.

    It's good to know that I can do it the other way around and use the legacy template method. I will redo that in my test environment and raise a separate issue as instructed if I find anything not working as it should.

    Thanks again

  21. edanzer
    Member
    Posted 10 months ago #

    @NFWRo: Thanks very much for the update. Keep us posted.

    @mellowvision: I think the issue you're seeing is that template functionality does not currently apply to NextGEN Pro galleries. It's just something that's in place for basic galleries that are part of the NextGEN Gallery.

  22. mouli
    Member
    Posted 8 months ago #

    Same issues here.
    I upgraded to NextGen 2.0.33 with an upgrade to WP 3.7 and my custom templates all failed.
    I use custom fields to add information to the images and the old method of template files in the theme folder worked really well.
    I can select the templates in my child theme in the gallery settings but they are not honoured in the front end of the site.
    This is a major for me so I am going to downgrade to 1.9 to fix it.

  23. Joe777
    Member
    Posted 8 months ago #

    I have the same issue. I have the latest WP and NG as of today's date (11/3/2013).

    I can get it to work for galleries, but not albums or tag galleries. To work for galleries I do the following:
    1. copy gallery.php into the themename/nggallery folder and rename it gallery-themename.php
    2. in the shortcode add this template=themename e.g.
    [ nggallery id=1 template=themename ]

    However, this only works for galleries, not albums or tag galleries. Prior to NG2.0 I copied gallery.php to the nggallery folder and modified it, and it worked for everything. After NG2.0, changing gallery.php in nggallery doesn't effect anything.

    Any advice?

  24. drsceifers
    Member
    Posted 8 months ago #

    I am updated to 2.0.33 but I have not gone to WP 3.7 yet.

    I am experiencing the single file issue. All my thumbnails are in a single column. I have the columns set to 0. This "might" be related to theme, as going to twenty thirteen seems to fix it. Unfortunately, I don't have that option since it's an existing site.

    I am using Thesis 1.8.4 on the site. Everything seemed to work great until the 2.0 switch over.

    Also, is there documentation for the 2.0 Module method? I am a developer and that could be very useful for another issue I am having with Album & Gallery templates.

    Thanks

  25. drsceifers
    Member
    Posted 8 months ago #

    I tried to switch to new shortcode, but got the same results.

    [ngg_images gallery_ids="3" display_type="photocrati-nextgen_basic_thumbnails"]

    Results in a single column of pics.

Reply

You must log in to post.

About this Plugin

About this Topic