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
Parse PHP code via block different way #11527
Comments
Apologies in advance if I'm not understanding exactly on a first pass. I'm actually pretty sure I read this incorrectly before when I labeled this issue with Since you mention theming and functions.php, it sounds like you are looking for functionality similar to the Appearance > Editor section that is currently available in WordPress wp-admin, only with a live preview. What I am not sure about is why you're mentioning shortcodes. One of Gutenberg's main goals is to eliminate the need for complicated shortcodes by using blocks instead. So I think we may be on the same page but just saying the same thing in a different way. |
Hi @StaggerLeee — I think it's unlikely that core will support this specific use-case, but you could certainly write a custom block with a PHP Again I don't think core would ever include this block, but it would definitely be possible to build. |
Hi. It is something for all those weird things, snippets, and even plugins without Gutenberg support. Just one Block with text input field for function name. All PHP code would be dealt with in custom functions.php, or custom plugin. Of course preview would not be possible, then it would be real Block. I know it is not something for Editor, talking about visual theme builder later when it comes. Yes, all those weird things where building complex and complicated Gutenberg real block is not justified. Or not worth it, timely. Or person cannot build Gutenberg blocks. I will later check second suggestion, thanks. Select is not option, as it tends to be long list. |
I see now that a custom block as @chrisvanpatten suggested is the correct advice here. I am closing this issue in favor of that advice. Thank you! |
As it is meant to be full blooded visual theme maker/editor I suggest you make it easy to parse PHP code via one custom block. And for now to not to do it via shortcodes.
I know directly writing PHP code in block will never be allowed.
Something so simple as "Functions Block". (in custom functions.php)
It can be hidden, to not to force it to Users and clutter space for people who will not need it. Will be used mostly by developers.
function some_function () { echo 'some other code'; } add_filter('init', 'some_function');
Insert Functions block and in input field write name of the function: some_function.
Some easy way to parse PHP code via Block would be needed for visual theme editor. Shortcodes are OK, but in some cases complicated to convert to. And in some cases stubborn to work OK.
The text was updated successfully, but these errors were encountered: