Support » Plugin: Meow Gallery (+ Gallery Block) » Converting existing WP galleries

  • Resolved Gmads

    (@gmads)


    Hello,

    I am working on a new site, and I have added a gallery to most posts. This I did by selecting the standard WP Gallery option from the Gutenberg block menu. While it seems to have some issues, like in some cases the images displayed are very small –icon-like– when selecting a two-column gallery, in general terms they look fine.

    I just installed and activated the Meow Gallery plugin, and read at the tutorial page that “If you already have galleries, you can convert them easily to the Meow Gallery Block”, but it does not specify how. Do I have to go through every post to select the WP gallery and change it to the Meow one via the Gutenberg block menu?

    This leaves me wondering… if for some reason later I need or want to uninstall this plugin (though I am sure I will not have to), will I have to do the same process in reverse before uninstalling the plugin? From what I understand, that’s what I would have to do, so it certainly does not sound like much fun.

    From what I also understand, if the galleries had been set-up by using the so called “shortcode”, all these conversions to and from would then have been unnecessary. Is that right? If so, is there some way to automatically convert all my default WP galleries so they use the shortcode?

    Thanks in advance,
    Guillermo M.

Viewing 5 replies - 1 through 5 (of 5 total)
  • It is said that a lack of an answer is an answer by itself, so I guess I must have stated the obvious. Time to look somewhere else.

    Thanks.

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hello,

    Sorry, those times aren’t the best for everyone, so I couldn’t reply to you earlier.

    This leaves me wondering… if for some reason later I need or want to uninstall this plugin (though I am sure I will not have to), will I have to do the same process in reverse before uninstalling the plugin?

    Thanks, Gutenberg for the way it does that, I wrote to the WordPress team to reconsider how they were building the blocks but they don’t really care much of input from outside developers. Blocks are mostly incompatible with each other. With other galleries, it will simply stop working completely if you disable the plugin or if the plugin crashes for some reason.

    With Meow Gallery, that problem doesn’t happen; it creates a standard shortcode, and for that reason, even if the plugin is removed, the galleries will still be displayed on your website.

    If you want to modify those galleries on your website, indeed, a message stating that “Your site doesn’t include support for the meow-gallery/gallery block”. You will have the choice to click on “Keep as HTML”, which will result in the pure shortcode version, and from there, it can be converted into a Gutenberg gallery.

    Usually, the way to get the answer to this is simply to try (that will be better than my answer, which you need to believe), and if any issue, to contact us 🙂 These days, the priority is currently to our customers and technical issues, among with other… somewhat, unrelated and unfortunate priorities; we are trying our best.

    Ok, after some Googling and reading a few articles, and for anyone newcomers that may be just starting with WP and plugings, it turns out that the so-called WP Shortcodes will become a thing of the past, as the new WP (5.0 upwards) is based on a new paradigm: Gutenberg Blocks.

    Given this new underlying mechanism, if one wants to stay on the safe side, at least on a long-term basis, one should then forget about shortcodes. The real question should not have been how to convert the new default WP blocks (be them for a gallery or any other element) into a shortcode, but the other way round.

    While it certainly seemed tempting to go throught my site and change every gallery block into a shortcode so as to then be able to use the Meow plugin, specially because even if I later were to uninstall it my site would not break because the plugin actually uses the WP shortcode, it has now become clear that this would be a step backward. Yes, shortcodes work and there is even a shortcode block, but it does seem a better strategy to stop using them.

    What options does one have?

    1. Use the WP default gallery Gutenberg block code.
    2. Look for a gallery plugin that natively uses block code.
    3. Wait for the Meow Gallery to migrate from shortcodes into blocks.
    4. Keep on using shortcodes.

    — References

    https://wordpress.org/support/topic/shortcodes-vs-blocks-2/

    https://wptavern.com/wordpress-developers-learn-how-to-convert-shortcodes-to-gutenberg-blocks

    https://www.affordablewebsiteorlando.com/learn-convert-shortcodes-gutenberg-blocks-wordpress-developers/

    https://www.codeinwp.com/blog/adapt-your-plugin-for-gutenberg-block-api/

    Or just google something like “wordpress shortcodes or gutenberg blocks.”

    Cheers!

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    It is not a step backward at all; actually, the Meow Gallery is creating a block, a real block 🙂

    Inside the block created by Meow Gallery, like with any other block, there is also the generated HTML (that’s the way we have the preview). By laziness (I guess? or because it’s much simpler?), most blocks are writing the final HTML directly in that block, and that’s all. In the case of Meow Gallery, it also does this, but it keeps the generated HTML only for the preview in the block. It uses a shortcode on top of this.

    So why did I do this? It’s more work for me, after all. I could have used that generated HTML directly, and avoid going through the shortcode for this (which means, the block has to also maintain that shortcode). But what if you change the general settings? What if you want to change the way the gallery looks on all the pages at the same time? What if there is an issue, and all the galleries should be modified or adapted? What if you uninstall the plugin? All the other blocks you are using, if you uninstall the plugin, they will simply… crash. Game over. Of course, most of them don’t care. But personally, I do. The beauty of WordPress is the ability to modify one’s website, switch plugins and so on.

    The shortcode, here, is used internally. You don’t need to think about it. And it’s not a thing of the past, it’s part of the framework and used for thousands of different things.

    But yes, with Gutenberg, your goal is to create everything with blocks, and not with shortcodes. Blocks are visual, with settings, so yes, from that perspective, building a page with shortcodes is going backward. But using the Meow Gallery, you are not going backward, you are using a block 😉

    It has only advantages. It’s easier for a user to avoid using a shortcode inside a block, it’s less work. But the block will be limited to this page, and if a change has to be made globally (or the plugin removed), it will fail. That’s also why so many people dislike Gutenberg because most blocks weren’t built dynamically.

    Hello Jordy,

    Thanks for your comprehensive answer. I hadn’t followed-up because I had to put on hold working on the site for a few days, but I’m back to it. I’ve been doing some tests in order to understand a bit more this subject.

    First, to answer my own question: yes, one does have to go through every post to select each WP gallery and change it to the wished new one via the Gutenberg block menu. And also “yes”, if for one reason one wants to uninstall whichever plugin was used one has to repeat the same process and change each gallery into the WP standard one, otherwise one would end up with the following error message:

    Your site doesn’t include support for the “uninstalled-plugin-name” block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.

    Given that everything is just HTML code, I had initially assumed that this process had to be done only when using shortcode-based plugins, but this is not so, it actually has to be done regardless of the inner workings of the plugin, that is, irrespectively of them using a shortcode or HTML code. So, there’s no real difference in using either of them, one has to manually change everything via the Gutenberg block menu, to and fro.

    What I learned about this “block” thing is that they are just pieces of HTML code surrounded by comments whose content defines the type of block. A paragraph block, for example, is just a starting “wp:paragraph” comment, followed by the paragraph itself and ended with a “/wp:paragraph” comment.

    Indeed, shortcodes will not go away any time soon, but the recommendation is to change them, as indicated in the FAQ.

    “We would recommend people eventually upgrade their shortcodes to be blocks.”
    https://developer.wordpress.org/block-editor/principles/faq/#how-do-shortcodes-work-in-gutenberg

    As there exists a standard shortcode block, which is just the original shortcode surrounded by the corresponding opening and closing comment lines, I’d say that the recommendation implies using HTML code instead of just leaving the shortcode.

    Anyway, given all the converting and possible reconverting, I decided to stick with the standard gallery, but I’ll consult my client about all this.

    Once again, thanks for your answers.

    Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Converting existing WP galleries’ is closed to new replies.