• I like to draft my WordPress blog posts in a separate rich text editor then paste the whole thing into the Gutenberg editor to do the finishing touches. I have placeholders for images throughout the draft, which I would like to automatically turn into image blocks when I paste them into Gutenberg. Right now, they are pasted as paragraph blocks and I have to manually convert each one into an image block. Is there something like a shortcode that I can use to automatically generate image blocks?

    • This topic was modified 2 years, 1 month ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    As you likely surmised from the lack of response so far, there’s no shortcode you can use to do what you want. Actually, shortcodes wouldn’t be the best approach because they are processed upon output for every request. It’s better to have the desired content saved in the DB since it’s the same for every request. In order to achieve that you’d need some custom JavaScript that processes the pasted in content, looking for instances of your placeholder, made into paragraphs by Gutenberg. The script could then convert the paragraph block into a proper image block (assuming the data unique to that image is in place, such as its URL or ID).

    AFAIK there’s nothing like this “off the shelf”, but something could be custom developed.

Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode for images block?’ is closed to new replies.