I have created a new plugin, WP-ShowHide. It is a simple plugin (83 lines of codes including comments) with no configuration screen needed.
This new plugin came about when Hisham tweeted me about whether there is a “Show/Hide Press Release” WordPress plugin like what Engadget does when posting a Press Release.
I can’t seem to find it and decided to code one myself using WordPress ShortCode API. I made the plugin more generic rather than focusing on Press Releases, so you can have multiple Show/Hide content within a post.
I tested it on WordPress 3.1.1 but technically it should work with any version higher than WordPress 2.5 because ShortCode was introduced in WordPress 2.5.
WP-ShowHide Description
Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link. By default the content is hidden and user will have to click on the “Show Content” link to toggle it. Similar to what Engadget is doing for their press releases.
Example usage:
[ showhide type="pressrelease" ]Press Release goes in here.[ /showhide ]
(Remove the spaces before and after the square brackets [].)
Download: WP-ShowHide 1.00
Documentation: WP-ShowHide
Demostration/Example Usage
Remove the spaces before and after the square brackets [].
Tag: [ showhide ][ /showhide ]
Tag: [ showhide type="links" more_text="Show Links (%s More Words)" less_text="Hide Links (%s More Words)" ][ /showhide ]
Tag: [ showhide type="visibility" hidden="no" more_text="Show Visibility Content (%s More Words)" less_text="Hide Visibility Content (%s More Words)" ][ /showhide ]
The visibility of this content is set to display by default instead of hidden.