Legacy template bulk update on old posts
-
I have a lot of old posts with a gallery attached using a legacy template inserted by the old “nextgen-attach_to_post? way, the one that inserted a thumbnail with an image with a “Clik to edit” text overlay.
Some time ago I switched themes, and the path for that legacy template changed, so now I’m getting an error showing “[Not a valid template]” instead of gallery preview as expected.
I tried doing serch ande replace on database for “old path for template” to “new path for template”, but still seeing [Not a valid template] error. Is there any way to bulk update those old posts to reflect changes?
Thanks a lot
-
Hi, @sottovoce,
can you please provide us with a textual shortcode example that doesn’t work?
Thanks
MihaiSure. This one is not working:
<img src="MYWEBSITE/nextgen-attach_to_post/preview/id--98844" />
-
This reply was modified 6 years, 1 month ago by
SottoVoce.
Hi @sottovoce
That shortcode is pretty old.
NextGen Gallery should read that old shortcode, but in case you are using a custom gallery template, you will need to reinsert the gallery.This might be the same problem you are experiencing on the thread: https://www.ads-software.com/support/topic/thumbnails-randomly-got-bigger/
This is indeed not an easy problem to solve; you already mentioned 2.744 galleries.
My first thought is that you need to perform a full website backup before attempting anything in the first place.Please, try reinserting one gallery to check if the new shortcode works and the custom template is working as well (you might need to check if that template is located in the right path).
You might find some reference to the right path to the custom gallery template here: https://www.google.com/search?client=firefox-b-d&q=page+template+nextgen+gallery
Let’s check if one of the galleries works that way.
Please, keep us posted.– Gaby, Customer Support.
Updating old inserted gallery by manually selecting the right template from drop down list in
customize display settings -> Legacy (Old) Templates
, inserts gallery correctly, and it changes html as following:From:
<img class="ngg_displayed_gallery mceItem" src="https://www.MYWEBSITE.com/nextgen-attach_to_post/preview/id--107218" data-mce-placeholder="1?>
To:
[ngg src="galleries" ids="1879" display="basic_thumbnail?]
You mention that that shortcode is pretty old, but it was inserted by using menu icon from NGG plugin by the time the post was created. If NGG should read that old shortcode, the only thing that changed now is the path for the legacy template, but I can’t figure it out where it’s stored into the database.
I Successfully changed another shortcode that some version of NGG also used, and I did it by searching and replacing template path from database. It was easy because path was present in html:
[ngg_images source="galleries" container_ids="2534" display_type="photocrati-nextgen_basic_thumbnails" override_thumbnail_settings="0" thumbnail_width="75" thumbnail_height="75" thumbnail_crop="1" images_per_page="8" number_of_columns="0" ajax_pagination="0" show_all_in_lightbox="0" use_imagebrowser_effect="0" show_slideshow_link="0" slideshow_link_text="[Mostrar presentación de diapositivas]" template="/home/wpress/public_html/wp-content/themes/MYTHEME/nggallery/MYLEGACYTEMPLATE.php" order_by="filename" order_direction="ASC" returns="included" maximum_entity_count="500?]
But I can’t find template path to replace for the other old shortcode style.
Can you please try to add via an SQL query the following shortcode parameter to the current shortcode:
template="/home/wpress/public_html/wp-content/themes/MYTHEME/nggallery/MYLEGACYTEMPLATE.php"
The new shortcode will looks something like this:
[ngg src="galleries" ids="1879" display="basic_thumbnail" template="/home/wpress/public_html/wp-content/themes/MYTHEME/nggallery/MYLEGACYTEMPLATE.php"]
Hope this helps,
MihaiI don’t completely understand where the old path is stored inside database. If I go to edit some of this old posts I see something similar to this:
<img class="ngg_displayed_gallery mceItem" src="https://www.MYWEBSITE/nextgen-attach_to_post/preview/id--81950" alt="" data-mce-placeholder="1?>
.Old template path is not embedded inside post, so I assume that resides inside database.I would like to run an update query as you suggested, but I’m not quite sure where
/home/wpress/public_html/wp-content/themes/MYTHEME/nggallery/MYLEGACYTEMPLATE.php
is located. I can’t find it inside wp_postmeta, ngg_album, ngg_gallery or ngg_pictures.I would greatly appreciate any advice on this.
Thank you.
Hi @sottovoce,
The custom template used to be located in your
MYTHEME/nggallery
theme’s folder from your WordPress installation folder.Since it is a custom template that you’ve added, you will of course need to first make sure that it is in place first.
Mihai
Mihai,
I understand where template file resides, which I don’t understand is where it’s referenced inside database, to be able to change that path using a database query.
Thank youAfter doing a little bit of research, I realized that the
/nextgen-attach_to_post/preview/id--XXXX
part included on that galleries inserted on old posts references to an image stored inside a folder nameddynamic
that resides inside of each gallery folder, which is the image that appears with a legend overlaid that shows “NextGEN Gallery Click to edit” when editing that old posts.Now that we know that the
id--XXXX
part references to that image, I guess that there must be a way to join that information with gallery ID inside wp_ngg_gallery or wp_ngg_pictures NGG tables, to be able to update wp_posts accordingly.-
This reply was modified 6 years ago by
SottoVoce.
Well, I finally realized that this “[Not a valid template]” error is related with our recent move to new server. The way that galleries were inserted by previous versions of the plugin somehow harcoded the path to the template, so switching to a new server with different path seems to be the cause for this error.
I insist, is there any way of changing this path without the need of manually going though editing each post one by one? I can’t believe there isn’t.
Regards
Hi @sottovoce
Apologies, the main issue is that you are using a shortcode from 2 years ago.
At this moment there is no other available workaround except manually re-inserting those galleries using Custom Gallery Templates.We want to take a closer look at this particular issue. Would you feel OK with that? If so, please send us a bug report here: https://www.imagely.com/report-bug, refer back to this forum thread and let them know Gaby referred you.
– Gaby, Customer Support.
Sure I’m using a code from 2 years ago. And I’m also using codes from 10 years ago, because I started using Alex Rabe’s plugin in 2008.
That ?2 years ago? code that you mention, was the one that the plugin automatically inserted when that posts were created 2 years ago, until you guys changed the way it works to whatever style is current now.
So I asume that the posts that I’m creating right now will be useless in two years time following the same criteria.
I wasted hours trying to get this work, and it would have been better a straight answer to this if Imagely knew that there is no way to do it besides than editing each post. I took the time to read a lot of threads that talks about this same situation, and the only answer form Imagely was to run the NextGEN Gallery Reset plugin.
I will fill that bug report that you are asking, but I feel that Imagely is not clear enough about what is causing this. The only thing I know is that only you guys know how your plugin works, you changed the way it inserts the code into posts, and galleries are not working anymore with the now ?old? code.
We are talking about a 8-year-old site with thousands of posts and more than 2.700 inserted galleries. You must understand why I’m not happy with this situation.
Thank you for taking the time to answer anyway.
Hi @sottovoce
Apologies, and because I’m aware that the number of posts, that’s why I’m politely asking you to open a bug report.
We need those bug reports to have the record in our ticket platform and to report that back to the developers.
I never said that we were not going to take a look or do anything about it.
I hope you understand.
So, if you have some time, please create that bug report for us, We’ll keep the conversation in that ticket, after we have a solution I’ll be happy to share that in this forum post, in that way it will be available to the rest of the community.https://www.imagely.com/report-bug
Refer back to this forum thread and let them know Gaby referred you.– Gaby, Customer Support.
I filled the bug report, as detailed as possible.
I appreciate your help, and I hope they can find a solution.
RegardsHi @sottovoce
Yes, we received your report.
Thank you. Have a great weekend.– Gaby, Customer Support.
-
This reply was modified 6 years, 1 month ago by
- The topic ‘Legacy template bulk update on old posts’ is closed to new replies.