Gutenberg: Checking current template type?
-
I am building a custom Gutenberg block to display image galleries.
I need a way to check in the Gutenberg editor what the current template/Post type that the the user is editing.
I have a setting called sourceFromCurrent which tells the block to get the images that will be displayed in the gallery from a meta field associated with that Post Type.
Of course, for this to work and not cause confusion, I’ll want to hide that setting if the user is not editing a template. For instance, if the user is editing a post (not a post single template), I don’t want them to be able to select the sourceFromCurrent option, however if they are editing a Single Post, Page, etc. I do want to enable that setting.
Is it possible to get the currently-being-edited Template?
- The topic ‘Gutenberg: Checking current template type?’ is closed to new replies.