Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
check.js
index.js
style.scss

README.md

PostFeaturedImage

PostFeaturedImage is a React component used to render the Post Featured Image selection tool.

Setup

It includes a wp.hooks filter editor.PostFeaturedImage that enables developers to replace or extend it.

Examples:

Replace the contents of the panel:

function replacePostFeaturedImage() { 
	return function() { 
		return wp.element.createElement( 
			'div', 
			{}, 
			'The replacement contents or components.' 
		); 
	} 
} 

wp.hooks.addFilter( 
	'editor.PostFeaturedImage', 
	'my-plugin/replace-post-featured-image', 
	replacePostFeaturedImage
);

Prepend and append to the panel contents:

var el = wp.element.createElement;

function wrapPostFeaturedImage( OriginalComponent ) { 
	return function( props ) {
		return (
			el(
				wp.element.Fragment,
				{}, 
				'Prepend above',
				el(
					OriginalComponent,
					props
				),
				'Append below'
			)
		);
	} 
} 
	
wp.hooks.addFilter( 
	'editor.PostFeaturedImage', 
	'my-plugin/wrap-post-featured-image', 
	wrapPostFeaturedImage
);
You can’t perform that action at this time.