PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / trunk
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution vtrunk
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Admin / meta / meta.js

meta.js in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution trunk, at src/Performance/Admin/meta/meta.js

44 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
2 import { __ } from '@wordpress/i18n';
3 import {
4 ToggleControl,
5 PanelBody,
6 } from '@wordpress/components';
7 import { useSelect, useDispatch } from '@wordpress/data';
8 import solidIcon from './icon';
9
10 const SolidExcludeMeta = () => {
11 const meta = useSelect((select) => select('core/editor').getEditedPostAttribute('meta'));
12 const { editPost } = useDispatch('core/editor');
13
14 if ( meta === undefined ) {
15 return null;
16 }
17
18 return (
19 <>
20 <PluginSidebarMoreMenuItem
21 target="swpsp-cache"
22 icon={ solidIcon }
23 >
24 { __( 'Cache Exclusion', 'solid-performance' ) }
25 </PluginSidebarMoreMenuItem>
26 <PluginSidebar
27 isPinnable={ false }
28 icon={ solidIcon }
29 name="swpsp-cache"
30 title={ __( 'Cache Exclusion', 'solid-performance' ) }
31 >
32 <PanelBody>
33 <ToggleControl
34 label={ __( 'Exclude from Page Cache', 'solid-performance' ) }
35 checked={meta._swpsp_post_exclude}
36 onChange={(value) => editPost({ meta: { _swpsp_post_exclude: value } })}
37 />
38 </PanelBody>
39 </PluginSidebar>
40 </>
41 );
42 };
43 export default SolidExcludeMeta;
44