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 { select } = wp.data; | |
| const { getPermalinkParts } = select( 'core/editor' ); | |
| const slug = getPermalinkParts().postName; | |
| console.log(slug); |
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 { dispatch } = wp.data; | |
| const { editPost } = dispatch( 'core/editor' ); | |
| const excerpt = 'Gutenberg Editor 🙌'; | |
| editPost( { excerpt } ); |
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 { select } = wp.data; | |
| const { getEntityRecords } = select( 'core' ); | |
| const MAX = 100; | |
| const categories = getEntityRecords( 'taxonomy', 'category', { per_page: MAX }); |
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 { select } = wp.data; | |
| const { getMedia } = select( 'core' ); | |
| const { getEditedPostAttribute } = select( 'core/editor' ); | |
| const mediaId = getEditedPostAttribute('featured_media'); | |
| const mediaUrl = getMedia(mediaId).source_url; | |
| console.log(mediaUrl); |
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 { dispatch } = wp.data; | |
| const { editPost } = dispatch( 'core/editor' ); | |
| editPost( { sticky: true } ); |
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 { dispatch, select } = wp.data; | |
| const { isFeatureActive } = select( 'core/edit-post' ) | |
| const { toggleFeature } = dispatch( 'core/edit-post' ); | |
| if ( isFeatureActive( 'fullscreenMode' ) ) { | |
| toggleFeature( 'fullscreenMode' ); | |
| } |
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 { select } = wp.data; | |
| const { getAuthors } = select( 'core' ); | |
| const authors = getAuthors(); | |
| const avatars = authors.map(a => a.avatar_urls[ '96' ]); // Available Sizes: 24/48/96 |
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 { select } = wp.data; | |
| const { getEntityRecords } = select( 'core' ); | |
| const tags = getEntityRecords( 'taxonomy', 'post_tag', { orderby: 'count', order: 'desc' }); |
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 { dispatch, select } = wp.data; | |
| const { editPost } = dispatch( 'core/editor' ); | |
| const { getEditedPostAttribute } = select( 'core/editor' ); | |
| editPost({ meta: { is_special: true } }) | |
| const isSpecial = getEditedPostAttribute( 'meta' )[ 'is_special' ]; |
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 { dispatch, select } = wp.data; | |
| const { editPost } = dispatch( 'core/editor' ); | |
| const { getEditedPostAttribute } = select( 'core/editor' ); | |
| editPost({ meta: { is_special: true } }) | |
| const isSpecial = getEditedPostAttribute( 'meta' )[ 'is_special' ]; |
OlderNewer