WP ShowHide Elements
2008-01-31 @ 18:27Adds 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.
- Download: WP ShowHide Elements
- Last updated: 2008-01-31
- Version: 0.1
- Tested with: 2.3.1
Install
- Upload the FOLDER ‘wp-showhide-elements’ to the /wp-content/plugins/
- Activate the plugin ‘WP ShowHide Elements’ through the ‘Plugins’ menu in admin
Usage
- Create a div to show / hide. Add an ID and name it whatever you want.
- 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.
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?
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.
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?…
2009-09-09 @ 14:37
Paul:
Try: my text
2009-09-09 @ 14:38
Paul:
Try: p id=”mytest” style=”display:none”
2009-10-16 @ 2:53
@paul:
try:
test
one, two, tree, four …
wp_showhide(‘mytest’)
it’s works :)
2009-10-16 @ 2:54
@paul:
try add:
””wp_showhide(‘mytest’) ””
2009-10-16 @ 2:55
@paul:
try add:
‘script’ wp_showhide(‘mytest’) ‘script’
of coure ‘ =
2009-10-16 @ 2:56
@paul:
try add:
’script’ wp_showhide(’mytest’) ’script’
of coure ‘ = > <
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?
Thanks!
2010-02-22 @ 0:35
Hey,
I’m also looking for a solution to this. How can the element be hidden by default and shown on click of the link?.
Thanks
2010-03-25 @ 15:50
Hi,
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
2010-06-01 @ 10:38
Yip, I would also like to find a solution to the text being hidden by default.
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?
Thanks!
2010-06-20 @ 2:24
Hello, where can I see a demo of this plugin?
Thanks a lot!
2010-07-07 @ 19:46
I also would like to know how we can have the text hidden by default.
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…
2010-07-28 @ 6:19
sorry
(input type = ”button” name = ”button” value = ”Show/Hide Code” onclick = ”wp_showhide(‘vbcode’)” /)
(div id=”vbcode” style=”display:none”‘)
code yadayadayada…
(/div)
2010-08-31 @ 12:34
try one of these plugins instead
http://wordpress.org/extend/plugins/tags/spoiler
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 […]
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;
}
add_shortcode(‘Showhide’,’Showhide’);
Here’s usage for the shortcode:
[Showhide title=’A really good Question?’]
With a really good answer.
[/Showhide]
Enjoy!
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;
}
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.
ryan
2011-08-26 @ 1:24
Hello
It’s possible to show/hide multiple elements?
Regards
curdaneta
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?
2011-11-18 @ 23:51
Where’s the demo?
2011-11-19 @ 15:27
I found an alternative that provides a working demo: http://www.farinspace.com/wordpress-peekaboo-plugin/
2013-03-13 @ 10:20
[…] Live demo example […]