Skip to content

Instantly share code, notes, and snippets.

@pbrocks
Created January 2, 2023 15:26
Show Gist options
  • Save pbrocks/2b507ea0040caa36759597d28e3f5d7a to your computer and use it in GitHub Desktop.
Save pbrocks/2b507ea0040caa36759597d28e3f5d7a to your computer and use it in GitHub Desktop.
Gutenberg Sidebar panel open by default
import { registerPlugin } from '@wordpress/plugins';
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
wp.data.dispatch( 'core/edit-post' ) .toggleEditorPanelOpened(
'gp-sample-document-setting-panel/sample-panel'
);
const GP_SampleDocumentSettingPanel = () => (
<PluginDocumentSettingPanel
name="sample-panel"
title="Sample Panel"
className="sample-panel"
>
Custom Panel Contents
</PluginDocumentSettingPanel>
);
registerPlugin( 'gp-sample-document-setting-panel', {
render: GP_SampleDocumentSettingPanel,
icon: 'palmtree',
} );
export default GP_SampleDocumentSettingPanel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment