How to Show and Hide Text in WordPress Posts with the Toggle Effect


Sometimes you may want to hide parts of your post or page content to give that article a compact look and allow users to click and see more information if they want. This technique is famously known as the toggle effect which is used across numerous websites in various different ways. The hidden content becomes visible when a user clicks on a specific link or button. This show/hide toggle effect is extremely handy for a FAQ page. You land on a page where you see bunch of questions listed. When a user clicks on the question, the answer expands right below. When you click on the question again, the answer will collapse. In this article we will show you how to show and hide text in WordPress posts and pages with the toggle effect.

If you don’t like the video or need more instructions, then continue reading.

First thing you need to do is install and activate the WP ShowHide plugin. The plugin works out of the box and there are no options for you to configure. To hide the text in posts using the toggle effect, you need to use the shortcode like this:

[showhide type="post"]Text you want to hide[/showhide]

Upon first usage of the shortcode you will notice that it shows the toggle link with the text “Show Press Release (xx more words)”. Actually the plugin was written specifically for a site that published press releases. However this text can be easily changed to whatever you like. Use the shortcode like this:

[showhide type="post" more_text="Show more..." less_text="Show less..."]
Text you want to hide

The showhide shortcode comes with some parameters that you can use to gain control on how it works in your individual posts. The default parameters and the values for the shortcode are these:

[showhide type="pressrelease" more_text="Show Press Release (%s More Words)" less_text="Hide Press Release (%s Less Words)" hidden="yes"]

We hope that you found this article helpful in adding the toggle effect to hide text in your WordPress posts and pages. Let us know would you rather use toggle effect to hide full posts or use default WordPress excerpt functionality?

Warning: A non-numeric value encountered in /home/u351846396/domains/ on line 308