WordPress Plugin: Toggle Show Hide

Sometimes when I make coding exercises for my readers, I would hide the solution by default, like so:

Simple Coding Challenge: Given this implementation of a singly linked list, delete all integer k.

public class Node {
    int val;
    Node next;

Turns out in WordPress, this is super easy. All you need is the plugin WP-ShowHide by Lester ‘GaMerZ’ Chan. You wrap the hidden content by

[_showhide] hidden content [/_showhide]

Note that I added the underscore _ so that my wordpress site won’t interpret it as hidden text. When you use it, remove the underscores!

Also, if you just leave it like so, the default attributes would be applied, which is

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

which look like


I conjecture the reason for this seeminly funny default values is (1) to demonstrate that you can get word count, and (2) default empty more_text would make users think the plugin is dysfunctional. Therefore, when you use it, always supply

  • more_text
  • less_text

2 Replies to “WordPress Plugin: Toggle Show Hide”

Leave a Reply

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