This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { apiFetch } = wp; | |
const { registerStore, withSelect } = wp.data; | |
const actions = { | |
setUserRoles( userRoles ) { | |
return { | |
type: 'SET_USER_ROLES', | |
userRoles, | |
}; | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edit: withSelect( ( select ) => { | |
return { | |
roles: select('phpbits/test-block').receiveUserRoles(), | |
}; | |
} )( props => { | |
console.log( this.props.roles ); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp.apiRequest( { path: '/phpbits/test-blocks/v1/user-roles/' } ) | |
.then( | |
( obj ) => { | |
console.log( obj ); | |
} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WordPress Dependencies | |
*/ | |
const { addFilter } = wp.hooks; | |
/** | |
* Add custom attribute for mobile visibility. | |
* | |
* @param {Object} settings Settings for the block. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WordPress Dependencies | |
*/ | |
const { __ } = wp.i18n; | |
const { addFilter } = wp.hooks; | |
const { Fragment } = wp.element; | |
const { InspectorAdvancedControls } = wp.editor; | |
const { createHigherOrderComponent } = wp.compose; | |
const { ToggleControl } = wp.components; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* External Dependencies | |
*/ | |
import classnames from 'classnames'; | |
/** | |
* Add custom element class in save element. | |
* | |
* @param {Object} extraProps Block element. | |
* @param {Object} blockType Blocks object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* External Dependencies | |
*/ | |
import classnames from 'classnames'; | |
/** | |
* WordPress Dependencies | |
*/ | |
const { __ } = wp.i18n; | |
const { addFilter } = wp.hooks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WordPress dependencies | |
*/ | |
const { __ } = wp.i18n; | |
const { Fragment } = wp.element; | |
const { toggleFormat } = wp.richText; | |
const { RichTextToolbarButton, RichTextShortcut } = wp.editor; | |
const { registerFormatType } = wp.richText; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add theme support for template blocks width | |
add_theme_support('editorskit-template-block-sizes', array( | |
'default' => array( | |
'default' => '700px', | |
'wide' => '1000px', | |
'full' => '1200px', | |
), | |
'page-templates/landing.php' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Genesis Framework layout support for blocks width | |
add_theme_support('editorskit-genesis-layout-block-sizes', array( | |
'content-sidebar' => array( | |
'default' => array( | |
'post' => '700px', | |
'page' => '800px', | |
), | |
'wide' => '900px', |