Skip to content

Commit

Permalink
Use availableTemplates when theme doesn't support block templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 25, 2022
1 parent 67f76a0 commit 7ff4411
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ function PostTemplateToggle( { isOpen, onClick } ) {
const templateSlug =
select( editorStore ).getEditedPostAttribute( 'template' );

const settings = select( editorStore ).getEditorSettings();
if ( templateSlug && settings.availableTemplates[ templateSlug ] ) {
return settings.availableTemplates[ templateSlug ];
const { supportsTemplateMode, availableTemplates } =
select( editorStore ).getEditorSettings();
if ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {
return availableTemplates[ templateSlug ];
}

const template = select( editPostStore ).getEditedPostTemplate();
Expand Down

0 comments on commit 7ff4411

Please sign in to comment.