I already added a new button in admin edit post but is in button list in that dropdown
But I want to add that button in header
Is there any chance to do that?
The code for first solution is:
( function ( wp ) {
var MyCustomButton = function ( props ) {
return wp.element.createElement( wp.editor.RichTextToolbarButton, {
icon: 'editor-code',
title: 'Add product',
onClick: function () {
jQuery(document).ready(function($){
$(".community-popup-overlay").addClass('active');
})
},
} );
};
wp.richText.registerFormatType( 'add-product/sample-output', {
title: 'Add product',
tagName: 'samp',
className: null,
edit: MyCustomButton,
} );
} )( window.wp );