• Resolved orenstransitpage

    (@orenstransitpage)


    I am one of the holdouts who used a legacy template on my site and with the recent announcement that the functionality to use the legacy template will be eliminated soon, am preparing my galleries for that change.

    I want to be able to have the gallery description appear above the thumbnails. I was able to do this using the legacy templates, but using the newer one I have not figured out how to do this.

    In addition, is the template=caption shortcode going to work once this change is made? I want the caption to appear below each thumbnail.

    Thank you, in advance, for helping me to prepare for these changes.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I too would like to know the answer, I tried following the documentation https://www.imagely.com/docs/legacy-templates-deprecation but my own template did not seem to get called.

    Do I have to specify a particular template in the shortcode? And if for example my shortcode is

    [album id="1" template="custom"]

    what file should I create, and where exactly in the path? Is

    wp-content/ngg/modules/photocrati-nextgen_basic_album/templates/custom-view.php

    or something else?

    I’m not sure if this is the recommended solution, but I was able to get captions under my thumbnails after migrating. To do so, I did the following:

    1. Make a copy of

    wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/default-view.php

    (I also renamed it to make it obvious what was what)

    2. I inserted this line

    <span><?php if (!$image->hidden) { echo $image->alttext; } ?></span>

    between lines 55 and 56, like so

                    />
                </a>
                <span><?php if (!$image->hidden) { echo $image->alttext; } ?></span>
            </div>
    				<?php
    
    				$this->end_element();

    Note that I use the alt text as my caption. If you need to use the description, substitute “description” in place of “alttext”.

    3. Upload the resulting file to

    wp-content/ngg/modules/photocrati-nextgen_basic_thumbnails/templates/yourfilename.php

    4. To make it active as my new default, I then went to NextGen Gallery / Gallery Settings / Basic Thumbnails / Select View and selected “custom/myfilename.php” from the dropdown.

    It also required some CSS tweaking, which I’m still working through, but the basic concept is there.

    You could probably do something similar for the gallery description, if you can find the correct call to get it.

    • This reply was modified 3 years, 11 months ago by PostmasterGS.
    • This reply was modified 3 years, 11 months ago by PostmasterGS.

    Thanks @postmastergs, I’m trying to follow a similar process for albums but it just doesn’t work for me, the custom template file in the wp-content/ngg directory structure doesn’t show up at all in the NextGen Gallery settings for albums (compact or extended).

    Unfortunately with no documentation and no actual working examples I’m stuck, at the moment the best option seems to use whatever time is left before the removal of the legacy templates functionality to migrate to a different gallery plugin.

    quicksilver,

    I don’t use albums, but I did a quick test and was able to make a custom template appear as an option. Using the Basic Extended Album for this test, I did the following:

    1. I made a copy of the following file and gave it a new name.

    /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_album/templates/extended/default-view.php

    2. I then placed the new file here:

    /wp-content/ngg/modules/photocrati-nextgen_basic_extended_album/templates/test-view.php

    3. Then went to Gallery Settings / Basic Extended Album / Select View and it showed up in the dropdown as custom/test-view.php.

    I didn’t attempt to do any customizations on it, but if you can see it, it should at least be working.

    I should also mention that there appears to be a naming requirement for the custom template, ending in template.php or view.php (ex. custom-view.php, default-view.php). This hasn’t changed from the old custom templates.

    Also, if you’re attempting to build a custom basic slideshow template, there isn’t a directory for it by default, so you have to create one at:

    /wp-content/ngg/modules/photocrati-nextgen_basic_slideshow/templates/

    Benjamin

    (@benjaminowens)

    Sorry for the delay answering questions here, we’ve been pretty busy (or just on vacation) with the holidays.

    I want to be able to have the gallery description appear above the thumbnails. I was able to do this using the legacy templates, but using the newer one I have not figured out how to do this.

    NextGEN 1x only allowed a single gallery at a time to be displayed which made it easy, but NextGEN 2 is pretty versatile and lets you mix multiple galleries. So the code I’m posting here will show the first gallery’s title, it’s up to you how to handle multiple galelries if you want to at all. This will only apply if your image source is from galleries; this won’t work if you’re displaying images based on tags or recently uploaded images. I can help if you need those though! ??

    if ($displayed_gallery->source === 'galleries' && !empty($displayed_gallery->container_ids)) {
        $gallery = C_Gallery_Mapper::get_instance()->find($displayed_gallery->container_ids[0]);
        print '<h1>' . $gallery->title . '</h1>';
    }

    Just use galdesc instead of title to show the gallery description.

    In addition, is the template=caption shortcode going to work once this change is made? I want the caption to appear below each thumbnail.

    The template parameter is not changing, it will always be used for the legacy template feature. The new templates use the parameter display_view and it can be used like so: display_view="custom/gallery-with-title-view.php"

    The shortcode is generated automatically for you if you use our popup window in the classic or block editor.

    @postmastergs Thanks for your advice here! Your suggestion for adding descriptions under thumbnails is just fine.

    @quicksilver03 as PostmasterGS said there is a requirement that the custom templates be named “-template.php” or “-view.php” and you need to use the new display_view parameter instead of “template” as I wrote above.

    I also want to reassure you that this feature isn’t going to be permanently discarded for quite for some time; we will most likely disable it but introduce a constant to bring it back and then later remove it from NextGEN but move it into a (free of course) companion plugin for those that still must use it.

    • This reply was modified 3 years, 10 months ago by Benjamin.

    @postmastergs @benjaminowens

    Thanks for you replies, I appreciate your help but I have to say that I haven’t yet tried your suggestions, because in the meantime I’ve been testing a migration to a different gallery solution and it has worked well enough that the people in charge of producing content want to try it on the live site.

    I’ve been able to port our custom template in a couple of hours of work, and I have to say that the documentation was clear. Whether or not this project will continue using NextGen Gallery depends on what those people prefer to use in the end.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Transitioning from Legacy Template’ is closed to new replies.