• Resolved facter

    (@facter)


    Hi.

    I recently changed themes and upgraded my website. I started doing posts using the following short code as it fit in much better with the site design

    [nggallery id=2 display_type=photocrati-nextgen_pro_masonry]

    this works great, and displays the gallery correctly in mosaic, which is what I want. However, for the past five years I had used

    [nggallery id=41]

    My question is – how do I set a default gallery display type so that the above shortcode automatically displays Mosiac instead of the style it does by default now?

    I am unable to find any option to make Mosaic the default style of gallery to display. What this means, is that I have *hundreds* of galleries using the old shortcode, that do not display my galleries in Nextgen pro Mosiac layout.

    So,how exactly do I change the default gallery display? I dont want to have to go into hundreds of posts and have to change all the code manually. Being able to set a default gallery style seems a no brainer to me, but I either cant find it and it doesnt exist, or I am completely blind as to how to actually set this.

    Thanks

    https://www.ads-software.com/plugins/nextgen-gallery/

Viewing 15 replies - 1 through 15 (of 24 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @facter – There is no method to change the NextGEN Legacy shortcode to a different display type than the basic thumbnails. There is no current method to set a default display type in NextGEN Gallery (or NextGEN Plus/Pro) at this time but you are more than welcome to share your thoughts and ideas on this as a feature request item here: https://imagely.com/feature-voting/

    Thanks!

    – Cais.

    Thread Starter facter

    (@facter)

    Whaaa, seriously? Are you saying that with all the features after all these versions, there is actually no way to global change the way that galleries are displayed in nextgen? That you’re stuck with the default, unless you manually change a line of code?

    I can’t even do a find and replace as there no way of doing so without screwing up the gallery Id…

    Seriously, my mind is boggling here and I find this pretty bizarre. It seems seems to me that this would be a very foundation level feature.

    Is there no code that can be changed to make this work? Are you actually saying that I have to go through 800 galleries and change every single short code in every post just to display a different gallery display? No simple “set global galley display” function?

    I mean. Ugh.

    Rather than selecting each post you could use a SQL query to update the shortcode and run that in phpMyAdmin or whatever software you use to manage your database (that’s if you want one style for all the galleries though. I was thinking of something like

    UPDATE wp_posts SET post_content = REPLACE(post_content, 'old shortcode', 'new shortcode') WHERE post_content LIKE '%old shortcode%';

    I strongly recommend backing up your database BEFORE doing that, just in case ??

    Thread Starter facter

    (@facter)

    Thanks Toto that’s a much more helpful piece if advice and Avenue to try. Okay, I don’t have a lot of experience with Sql but I do have phpmyadmin.. So, it’d look something like this?

    UPDATE wp_posts SET post_content = REPLACE(post_content, ‘[nggallery id=41]’, ‘[nggallery id=41 display_type=photocrati-nextgen_pro_masonry]’) WHERE post_content LIKE ‘%old shortcode%’;

    I’m pretty sure that’s wrong… As What I don’t get is how the I’d numbers are retained etc… Or do I use the Sql code exactly the way you posted it?

    I would like this feature as well. I’ll put a vote in, but is it possible to change some code in the plug in in the short term?

    @facter:

    My bad, sorry.
    I didn’t went into detail about how the IDs are retained. The above query won’t retain them really. To do so you would have to run multiple queries, one for every gallery id/album id. Still way faster to do it that way than having to edit posts manually.

    This might work

    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=1]', '[nggallery id=1 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=1]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=2]', '[nggallery id=2 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=2]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=3]', '[nggallery id=3 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=3]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=4]', '[nggallery id=4 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=4]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=5]', '[nggallery id=5 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=5]';

    That, in theory, should replace the old shortcode with the new shortcode for gallery ids 1 to 5. If you have more (well, i guess 41 at least) then you need to extend this query, increading the ID number.

    Well, that’s the theory. Never tried but it should work. Anyway, before making manual changes to the databas i STRONGLY recommend to create a fresh backup ??

    Thread Starter facter

    (@facter)

    Hi Toto,

    I see, that is actually very helpful, and I can see that working, thankyou very much mate.

    That said, oh man, yeh, there are about 800 galleries haha. I guess I can renumber those for 800 items .. it would certainly be quicker than going in and editing every single post, will still take a little time but hey. At least there is an avenue. I will test it with one gallery first I think.

    @cais – maybe you could implement a simple switch in nextgen that just updates the db like this? Im sure you could do it easier tho using some other method, and really, its a no-brainer feature and I am surprised it doesnt exist already.

    Plugin Contributor photocrati

    (@photocrati)

    @facter@totohabschned’s approach is probably going to be the most functional method to mass changing entries in general for a WordPress installation. Also, for the most part this would be a one-off operation (although it could be used multiple times as needed) but generally speaking this more or less goes against the general approach to how the IGW works in its base functionality which is to say each instance of the IGW is meant to be unique and continue to work as is no matter what changes you make in most any other setting for the plugin.

    Does this mean we would never add such a feature set of bulk changing display types, absolutely not … we’ve discussed this idea several times internally but it is far from simple in our minds on how it would need to be implemented. That being the case we see this as most likely requiring a complete release cycle in and of itself to do it right and currently we are not willing to forego all other ideas to implement it.

    Thanks for the feedback and please do continue to make feature requests as the community’s voice can have an impact on future options and enhancements.

    – Cais.

    Thread Starter facter

    (@facter)

    @toto Habschned

    I had opportunity to test this out today, and I populated an excel sheet with an iteration of these numbers using the following Excel forumla (which worked amazingly when placed in column A1)

    =CONCATENATE(“UPDATE wp_posts SET post_content = REPLACE(post_content, ‘[nggallery id=”,ROW(B1),”]’, ‘[nggallery id=”,ROW(B1),” display_type=photocrati-nextgen_pro_masonry]’) WHERE post_content LIKE ‘[nggallery id=”,ROW(B1),”]’;”)

    This gave me a list of all the id numbers to be updated – here is an example

    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=15]', '[nggallery id=15 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=15]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=16]', '[nggallery id=16 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=16]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=17]', '[nggallery id=17 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=17]';
    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=18]', '[nggallery id=18 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=18]';

    Unfortunately, when I put this into phpmyadmin and ran the SQL query, it came back with

    “# MySQL returned an empty result set (i.e. zero rows).”

    This indicates that somewhere in the SQL it didnt correctly select the rows or that it didnt find the content in them. Can you see why it may have returned this result at all? your help is very much appreciated, I feel like Im almost there in being able to implement this fix ….

    UPDATE wp_posts SET post_content = REPLACE(post_content, '[nggallery id=15]', '[nggallery id=15 display_type=photocrati-nextgen_pro_masonry]') WHERE post_content LIKE '[nggallery id=15]';
    I just ran that on a test post i made on my site. The post contained just the old shortcode [nggallery id=15], nothing else. Then went to phpMyAdmin and ran the above query. MySQL came back with the following message:

    2 rows affected. (Query took 0.0526 sec)

    So query-wise everything seems alright, i checked the post on my site and the shortcode got replaced just fine. That proves the query thing seems to be working fine.

    Erm..as four empty result set:
    Can you search the database for [nggallery id=15] in phpMyAdmin and see if that yields any results?

    Thread Starter facter

    (@facter)

    Well, this certainly is very perplexing.

    I have tried the search on verified tables/content etc searching for that term and I still get no results. The [nggallery id=15] is most definitely there in the right place, in post_content (I verified manually).

    So strange. I am using phpmyadmin under cpanel … I have a bad feeling there is something wrong with cpanel – why wouldnt it find the record with a simple search?:(

    I am using cPanel as well, and searching for that shortcode came back with the post just fine. It’s kinda hard to troubleshoot this one without being able to look at the database.

    Do you perhaps run multiple WordPress sites from just one database (using different table prefixes obviously)? That could be one explanation. What’s making me wonder is that you verified the presence of the shortcode in the post_contents field, yet a database search yielded no results. Did you, when searching, select all tables in phpMyAdmin?

    Thread Starter facter

    (@facter)

    I really wish I could attach screen grabs to this post. I contacted my hosting support and they said that they were actually able to get search results and etc just fine.

    My wordpress is standard install, no multiple sites in the one database etc

    As far as I am aware I am selecting all tables, Im on the SQL page and running it on the entire database .. also selecting all rows as well … to be honest, this is really frustrating, it should just run the query and find them and update them?

    I dont know. For wanting to do such a simple action as changing existing galleries style with a simple select, this is getting fairly meh. Ugh.

    That’s meh indeed hehe.
    If your host gets the search results just fine then so should you (given that you are searching the proper way. The search form in your phpMyAdmin should look like this

    Do you have multiple databases perhaps, and are searching the wrong one?

    Thread Starter facter

    (@facter)

    Hmm, okay, the search worked. I hadnt correctly selected the tables. My bad. Okay so the SQL search works fine then. It finds these records just fine now that I actually properly selected the tables.

    This still doesnt help me though, as running the SQL query still doesnt work – I only have the one database that I am in, and its definitely the right one as I am able to go into posts and check them.

    Could there be something wrong with the syntax of the query? Or am I making some other newbie mistake? It just comes back with

    # MySQL returned an empty result set (i.e. zero rows).

    I am running this via the Query box which says “Run SQL query/queries on database sswp01:”

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Set different gallery style to default?’ is closed to new replies.