is there any shortcode or a plugin that will add new quicktag, like this example:
[hidemytext]some hidden text[/hidemytext]
and any text inside those tag is hidden from the post or from the page.
Thanks and regards
is there any shortcode or a plugin that will add new quicktag, like this example:
[hidemytext]some hidden text[/hidemytext]
and any text inside those tag is hidden from the post or from the page.
Thanks and regards
You must be logged in to post a comment.
Simple answer:
But shortcodes should never be used like that. Imagine what happens when the plugin or theme with that shortcode is turned off: everyone can see the content now. This is not very user friendly.
So switch the logic: show nothing or the bare shortcode tag by default, show the content only if the shortcode handler is active. Store the hidden content in a simple metabox:
To do that, add a metabox with an editor and show its content per shortcode:
You really should be able to work this out from the examples in the Codex.
You could set up a filter hook and filter all post content. The hooked function would return a default “Not Permitted” type content or if the visitor has permission, the function would return the actual post content.
I’m about to implement something in TwitchPress that might use this approach but take it a step further. I might detect a specific block (basically detect the blocks tags/html) and hide all content after that block. This allows some flexibility when authoring posts.
The approach with a block isn’t much different from your own idea. The block just makes it all drag and drop instead of typing [hide] or something similar. Whichever approach, the post content requires filtering. I’m concerned about the extra processing as opposed to restricting the entire post and redirecting none permitted users to a standard “Not Permitted” page which done when WordPress is initializing.
So there are many approaches. Performance and flexibility will be different with each. I think I’ll implement them all in TwitchPress.