WP ShowHide Elements

2008-01-31 @ 18:27

Adds a Javascript for you to hide or show what ever ID you want, with a mouse click. You need to add some code to your theme to make it work. With this you can create dynamic menus that can easily be hidden or shown.


  1. Upload the FOLDER ‘wp-showhide-elements’ to the /wp-content/plugins/
  2. Activate the plugin ‘WP ShowHide Elements’ through the ‘Plugins’ menu in admin


  1. Create a div to show / hide. Add an ID and name it whatever you want.
  2. Create a anchor and add the ID of your div into wp_show() function.
<p id="mytest">my text</p>
<a href="javascript:void(0);" onclick="wp_showhide('mytest')">my link</a>

Possible future upgrades

  • Support for multiple elements to be closed in one click
  • Choice on what specific pages to include the Javascript

Bug report

If you have found a bug I want to know about it so I can fix it.

  • Tell me your version number, WordPress version and what browser you use.
  • If you suspect a collision with another plugin, tell me what plugin you suspect, or send me a list with suspected plugins
  • Have you tested this plugin on another WordPress-version and can confirm that it works? Let me know!

Known bugs

  • No bugs reported so far

Contribute / Feedback

The best way to contribute today is to spread the word, link to this page, blog about WP ShowHide Elements or give me feedback. All kinds of feedback are helpful to me. Suggestions and bug report are also welcome.

RSS-feed för kommentarer

28 svar till “WP ShowHide Elements”

  • Paul
    2009-06-03 @ 7:23

    i want to display a post with div hidden at start.it contains answer to the question.how can i do that?

    • Stan
      2011-08-17 @ 6:21

      Did I miss something? Seems I’m missing/wanting the same as many others. First of all. Thank you. The WP ShowHide Elements plug in is exactly what I was looking for. eassily installed and it (more or less) does just what it is supposed to do ..BUT when the page first loads, the default is to ”show” with clicking the link to ”hide”. I’d prefer the reverse (default to ”hide” click the link to ”show”.) .

      I tried changing the ”block” or ”none” in various other combinations in the ”wp-showhide-elements.js” but couldnt get it to work as I wanted.

  • Francisco
    2009-09-06 @ 20:23

    Can you add something like a cookie to remember the status of the IDs (to show or hide) when we navigate through the site or reload the page?…

  • Francisco
    2009-09-09 @ 14:37

    Try: my text

  • Francisco
    2009-09-09 @ 14:38

    Try: p id=”mytest” style=”display:none”

  • Maliniak »
    2009-10-16 @ 2:53

    one, two, tree, four …

    it’s works :)

    • Maliniak »
      2009-10-16 @ 2:54

      try add:
      ””wp_showhide(‘mytest’) ””

    • Maliniak »
      2009-10-16 @ 2:55

      try add:

      ‘script’ wp_showhide(‘mytest’) ‘script’

      of coure ‘ =

    • Maliniak »
      2009-10-16 @ 2:56

      try add:

      ’script’ wp_showhide(’mytest’) ’script’

      of coure ‘ = > <

  • Adam
    2010-02-05 @ 20:37

    Help – I don’t understand how Paul’s problem got solved. How can the text be hidden at first, and then revealed?

  • Chris
    2010-02-22 @ 0:35

    I’m also looking for a solution to this. How can the element be hidden by default and shown on click of the link?.

  • Emma
    2010-03-25 @ 15:50

    I’m also looking for a solution to this problem. And to be able to make more than one element show on the same click. (Using download-elements with their own ID’s.)
    thank you

  • Graham »
    2010-06-01 @ 10:38

    Yip, I would also like to find a solution to the text being hidden by default.

  • Rachel »
    2010-06-08 @ 1:42

    I have the same question as everyone else. Was this ever resolved? How do you modify this plugin to hide the text initially?


  • Carlos Gonçalves
    2010-06-20 @ 2:24

    Hello, where can I see a demo of this plugin?
    Thanks a lot!

  • luis »
    2010-07-07 @ 19:46

    I also would like to know how we can have the text hidden by default.

  • RUfio »
    2010-07-28 @ 6:17

    This worked wonders for me, after installing and activating, inside posts I used a button as the switch:

    my vb code…

    • RUfio »
      2010-07-28 @ 6:19


      (input type = ”button” name = ”button” value = ”Show/Hide Code” onclick = ”wp_showhide(‘vbcode’)” /)
      (div id=”vbcode” style=”display:none”‘)
      code yadayadayada…

  • NotPaul
    2010-08-31 @ 12:34

    try one of these plugins instead

  • Broadcast 1 – Spirit and Dance « Classical Guy »
    2010-09-07 @ 4:56

    […] Live demo example September 6th, 2010 | Tags: Antonio, Bach, Franz Joseph, George Frideric, Handel, Haydn, Johann Sebastian, Tallis, Thomas, Vivaldi | Category: Baroque, Classical Period, Podcasts […]

  • Parrothead
    2010-09-17 @ 21:16

    I’ve been including this plugin in my themes for a while and came up with a shortcode to make it easier for my clients.

    Open source contribution.

    Add this to functions.php:

    function Showhide($atts, $content = null){
    extract( shortcode_atts( array(
    ‘title’ => ‘Add Title’,
    ), $atts ) );
    $nice_title = str_replace(‘ ‘,”,$title);
    $rand = rand(0,20);
    $accordion = ‘‘.$title.’‘;
    $accordion .= ”. do_shortcode($content) .”;
    return $accordion;


    Here’s usage for the shortcode:
    [Showhide title=’A really good Question?’]
    With a really good answer.


    • Parrothead
      2010-09-17 @ 21:22

      Code got mangled:

      Here’s the function again

      function Showhide($atts, $content = null){
      extract( shortcode_atts( array(
      ‘title’ => ‘Add Title’,
      ), $atts ) );
      $nice_title = str_replace(‘ ‘,”,$title);

      $rand = rand(0,20);

      $accordion = ‘<h5 class=”question”><a onclick=”wp_showhide(\”.$nice_title.$rand.’\’)” href=”javascript:void(0);”>’.$title.'</a></h5>’;
      $accordion .= ‘<div id=”‘.$nice_title.$rand.'” class=”answer” style=”display: none”>’. do_shortcode($content) .'</div>’;

      return $accordion;

  • Ryan B »
    2010-11-09 @ 23:17

    Thanks for the great plugin!

    I was having the same problem getting the hidden box to start closed, and was a little confused by some of the replies. I am sure there is a better solutions than this, and one possibly one that could be incorporated into the plugin itself, but all you have to do is on the hidden content section put style=”display:none;” this way the content starts hidden, and when the button is clicked it checks what the current status is and reverses it.


  • curdaneta »
    2011-08-26 @ 1:24

    It’s possible to show/hide multiple elements?

  • Dennison Uy »
    2011-09-02 @ 12:10

    I arrived here because I clicked on the demo link on the WordPress plugin website. I don’t see any demo though?

  • WP ShowHide Elements | Best Plugins - wordpress – widgets – plugin 2012 »
    2013-03-13 @ 10:20

    […] Live demo example […]