Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider omission of shortcode block from Block Based Theme Template Parts #23626

Open
DaisyOlsen opened this issue Jul 1, 2020 · 13 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Discussion For issues that are high-level and not yet ready to implement.

Comments

@DaisyOlsen
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Shortcodes have been a core functionality of WordPress since version 2.5. As such, there is an extremely wide usage of shortcodes across plugins and themes created by hundreds(more?) of plugins and themes. This is unlikely to immediately stop with the Gutenberg editor despite growing adoption as the primary content creation tool for WordPress.

Describe the solution you'd like
I would like to see support for the Gutenberg shortcode block to be included in Block-Based Theme/Full Site Editing functionality currently being developed for inclusion in core.

Describe alternatives you've considered
This request is based on my experience working directly with long-time content creators as well as many re-theming projects for existing sites with many and varied plugins dependencies.

An alternative to the immediate removal of this functionality in Block-Based theming would be a larger and longer-term initiative to phase out shortcodes.

@epiqueras
Copy link
Contributor

Related #20343

cc @youknowriad @azaozz @johnstonphilip

@epiqueras epiqueras added the [Type] Discussion For issues that are high-level and not yet ready to implement. label Jul 1, 2020
@youknowriad
Copy link
Contributor

Since block-based themes are not an existing API, we're not breaking any backwards compatibility and this more is more likely to encourage people to move away from shortcodes to blocks and formats.

An alternative to the immediate removal of this functionality in Block-Based theming would be a larger and longer-term initiative to phase out shortcodes.

As stated here, I see this as the beginning of the larger and long term phase out of shortcodes as we're not impacting any existing site while encourage folks to adopt the new technologies. Allowing them in block-based themes is likely to encourage their usage still and prevent the long phase out.

@azaozz
Copy link
Contributor

azaozz commented Jul 2, 2020

I see this as the beginning of the larger and long term phase out of shortcodes

Yes! At this point shortcodes are the WP equivalent of using HTML tables for layout :) There's absolutely no good reason to use 2007's tech in 2020. There are so many new, better ways to do things.

@DaisyOlsen
Copy link
Contributor Author

DaisyOlsen commented Jul 2, 2020

Yes! At this point shortcodes are the WP equivalent of using HTML tables for layout :) There's absolutely no good reason to use 2007's tech in 2020. There are so many new, better ways to do things.

I certainly can’t argue with this, it’s 100% true. This leads me to consider what else could the community be doing to remove barriers for adoption of Gutenberg for content creation. Also what can be done to encourage those that use shortcodes as a go-to solution for client work because it’s familiar to move to the unfamiliar territory of building the same functionality in a block.

Incidentally my husband showed me his work website, in the public education space, the other day. It uses tables for layouts and is not likely to change anytime soon. The end of shortcodes may be farther away than it appears.

@epiqueras
Copy link
Contributor

cc @annezazu

@aaroncampbell
Copy link
Member

Wanted to weigh in here since I did so in Slack when this was brought up.

I see this as the beginning of the larger and long term phase out of shortcodes

I agree that not adding shortcode support to new functionality like this is a good (and necessary) step toward phasing them out. Hopefully it will encourage people to use newer better methods while working with this new system.

@johnstonphilip
Copy link
Contributor

@azaozz I wonder if this GitHub issue would be a good place to provide more background details about this decision in more detail. While what you said here breifly touches on the "why"...

At this point shortcodes are the WP equivalent of using HTML tables for layout

...it can give the impression that they are bad simply because they are old, which isn't a great argument on its own. I wonder if we could communicate more of thinking behind this better. Would you be able to elaborate on the "why" behind shortcodes being phased out here? That way we can have a historical record of the thinking behind the decision, and people can reference what is said here if there are further questions or discussions.

I think communicating this more fully would go a long way to helping people understand.

@DaisyOlsen
Copy link
Contributor Author

I would also like to know more about the decision making process.

Further, I think there are some related questions regarding user experience if some blocks cannot be used everywhere. In its current iteration, there doesn't appear to be any clear delineation between what is controlled by the content and what is the template part. I did some experiments with adding a block that was either completely or partially "removed" and then moving it around on the page and the result was not ideal.

@annezazu
Copy link
Contributor

annezazu commented Jul 7, 2020

@johnstonphilip Thanks for flagging this as an opportunity to clarify vision. In digging into this, I found the following mentioned in the FAQ for Gutenberg:

https://developer.wordpress.org/block-editor/principles/faq/#should-i-move-shortcodes-to-content-blocks

However we see the block as an evolution of the [shortcode]. Instead of having to type out code, you can use the universal inserter tray to pick a block and get a richer interface for both configuring the block and previewing it. We would recommend people eventually upgrade their shortcodes to be blocks.

This made me notice that the FAQ is quite out of date and more sparse than it should be at this point! I opened this issue to start that update process: #23763

To expand on what's in place though, I think there are three major reasons (and more I'm not thinking of right now) for why blocks are the future and shortcodes are being phased out long term:

  • Blocks have visual editing built-in which creates a more rich, dynamic experience for building your site.
  • Blocks are simply html and don’t persist things the browser doesn't understand on the frontend. In comparison, if you disable the plugin that powers a shortcode, you end up with weird visuals on the frontend (often just showing the shortcode in plain text).
  • Blocks will be discovered more readily with the block directory coming in 5.5 in a way shortcodes never could be allowing for more people to get more functionality. This is super exciting thinking longer term.

Hope this provides more context :)

@azaozz
Copy link
Contributor

azaozz commented Jul 8, 2020

...It uses tables for layouts and is not likely to change anytime soon. The end of shortcodes may be farther away than it appears.

...it can give the impression that they are bad simply because they are old.

Right, I've also built dozens of websites (for friends) using tables in the late 90's. Couple are still around I think. It's not that it's bad, or that it doesn't work, but using "old tech" comes with lots of incompatibilities and limits. Don't think anybody would ever think of using tables for a new site in 2020 :)

It's similar with shortcodes in WP. Have you looked at how shortcodes work? All the regex parsing of the HTML on every page load, the limitations, the edge cases... At the same time there are new, better ways to do everything shortcodes can do, and lots more.

I wonder if this GitHub issue would be a good place to provide more background...

Totally agree! There are better ways, my bad, sorry.

@bobbingwide
Copy link
Contributor

I'm happily using shortcodes in my experimental Full Site Editing theme ( Fizzie ).
I primarily done this as a temporary solution, until I can replace them with a block.
In actual fact, I've written new shortcodes to deliver functionality that appears to be missing from the Full Site Editing blocks.

  • post modified date
  • Edit post link

What am I missing here?

@ndiego
Copy link
Member

ndiego commented Jul 16, 2021

I would like to provide some additional insight on this that I feel people might be overlooking. Shortcodes have been used for thousands fo different things. Yes, most shortcodes could easily become blocks. However, there are implementations that are impossible to become blocks.

Let's assume you have a shortcode the prints the current user's name. In a paragraph block, you could then do something like this "Hi there [user-name]!". Imagine this as a dynamic header on an Account page, or simply to personalize content throughout your website. While this works fine in posts, since shortcodes are rendered inside of post content, but it does not currently work in templates or template parts.

I do not see a way that this functionality could be replaced with blocks. Perhaps there is another way to add dynamic content within blocks, but I feel we need a solution for this. But, shortcodes are currently a viable solution that most WordPress users are already familiar with.

@iandunn
Copy link
Member

iandunn commented Nov 24, 2021

I may be doing something wrong, but I do see the Shortcode block in the Inserter when editing block templates.

Shortcodes also work when I type them directly into a paragraph block (with the surrounding brackets), or add them directly to a {template}.html file.

That's the way it should be, IMO. Requiring people to re-write shortcodes or switch 3rd party plugins would make it harder to switch to a block theme in the real world. Supporting shortcodes provides a realistic migration path, so folks can upgrade their site one piece at a time.

@annezazu annezazu added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") and removed [Feature] Full Site Editing labels Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Discussion For issues that are high-level and not yet ready to implement.
Projects
None yet
Development

No branches or pull requests

10 participants