开发者 |
janwyl
freemius |
---|---|
更新时间 | 2021年3月7日 18:03 |
PHP版本: | 4.7 及以上 |
WordPress版本: | 5.7 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/
directoryCheck out a few examples with explanation here.
For hooked editors that are hooked to an action, yes. For those hooked to a filter, no.
The output from actions is wrapped in a div with classes hec-content
and hec-content-[Hooked editor title]
where [Hooked editor title] is converted to lower case and spaces have been replaced by hyphens.
So for example, if the hooked editor has the title 'Site notice', then you can target the output container using the css selector .hec-content-site-notice.
Yes. Use the 'Hide Hooked Content' options for an editor. You can disable generic content, specific content, or both. The content will not be displayed on the front end.
It depends on the circumstances.
The WP Editor allows full html and shortcodes just like the normal post / page editor, while the text editor strips out any html, line breaks, etc. So text editor is probably best when you want to limit users to plain text content.
The full WP editor will generally be fine with an action, but filters might be a bit trickier. For example, if your theme outputs the filter like this echo esc_html( apply_filters( 'some_filter', $output ) );
then any html will be escaped. So unless you want to display escaped html, you're better off preventing any user confusion by choosing the text editor.
Click on 'Hooked Editors' in the main menu, then click on 'Re-order hooked editors' just below the main heading 'Editors' at the top of the screen. You can now drag the rows of the table into the order you want.
Yes. By default, only administrators can add, edit and delete hooked editors. The plugin uses the following custom capabilities, all of which are added only to administrators: edit_hec_hooks, edit_others_hec_hooks, publish_hec_hooks, read_private_hec_hooks, delete_hec_hooks, delete_private_hec_hooks, delete_published_hec_hooks, delete_others_hec_hooks, edit_private_hec_hooks, edit_published_hec_hooks. You can add some or all of these capabilities to other roles or users. Note that on deactivation the plugin only removes these custom capabilities automatically from the administrator role. If you add capabilities to other users or roles they will not be removed automatically.
Yes, by selecting or de-selecting the post type in the 'Included post types' meta box when editing the hooked editor. You can also filter the included post types using the filter hec_included_post_types
:
function mytheme_include_my_cpt( $included_post_types, $hooked_editor, $hooked_editor_info ) { $included_post_types[] = 'my_custom_post_type'; return $included_post_types; } add_filter( 'hec_included_post_types', 'mytheme_include_my_cpt', 10, 3 );
If you switch to a new theme you won't lose any of the hooked content, but it will be hooked to actions / filters in the old theme, so it won't display to start with. You will need to update the settings of your hooked editors so that they are hooked to actions / filters in your new theme. Note that you can hook an editor to more than one hook, so if you're switching between themes a lot for some reason, you could hook an editor to one hook in one theme and an equivalent hook in another.