WordPress – 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.

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 [/showhide]

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.

Looking for quality WordPress Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , , , | Posted under WordPress | RSS 2.0

Author Spotlight

TJ Marsh

My name is Tj Marsh. I spend about 16 hours a day on the internet. Running my company and helping out here at Arvixe. I live in the good ole Arizona where it gets ridiculously hot. I love WordPress and a lot of other open source software along with coding.

Leave a Reply

Your email address will not be published. Required fields are marked *