Version Description
N/A
Download this release
Release Info
Developer | GamerZ |
Plugin | WP-ShowHide |
Version | 1.00 |
Comparing to | |
See all releases |
Version 1.00
- readme.txt +76 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- wp-showhide.php +84 -0
readme.txt
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP-ShowHide ===
|
2 |
+
Contributors: GamerZ
|
3 |
+
Donate link: http://lesterchan.net/site/donation/
|
4 |
+
Tags: show, hide, content, visibility, press release, toggle
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: trunk
|
8 |
+
|
9 |
+
Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
By default the content is hidden and user will have to click on the "Show Content" link to toggle it. Similar to what Engadget is doing for their press releases. Example usage: `[showhide type="pressrelease"]Press Release goes in here.[/showhide]`
|
14 |
+
|
15 |
+
= Previous Versions =
|
16 |
+
* N/A
|
17 |
+
|
18 |
+
= Development =
|
19 |
+
* [http://dev.wp-plugins.org/browser/wp-showhide/](http://dev.wp-plugins.org/browser/wp-showhide/ "http://dev.wp-plugins.org/browser/wp-showhide/")
|
20 |
+
|
21 |
+
= Translations =
|
22 |
+
* [http://dev.wp-plugins.org/browser/wp-showhide/i18n/](http://dev.wp-plugins.org/browser/wp-showhide/i18n/ "http://dev.wp-plugins.org/browser/wp-showhide/i18n/")
|
23 |
+
|
24 |
+
= Support Forums =
|
25 |
+
* [http://forums.lesterchan.net/index.php?board=36.0](http://forums.lesterchan.net/index.php?board=36.0 "http://forums.lesterchan.net/index.php?board=36.0")
|
26 |
+
|
27 |
+
= Credits =
|
28 |
+
* N/A
|
29 |
+
|
30 |
+
= Donations =
|
31 |
+
* I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appericiate it. If not feel free to use it without any obligations.
|
32 |
+
|
33 |
+
== Changelog ==
|
34 |
+
|
35 |
+
= Version 1.00 (01-05-2011) =
|
36 |
+
* FIXED: Initial Release
|
37 |
+
|
38 |
+
== Installation ==
|
39 |
+
|
40 |
+
1. Open `wp-content/plugins` Folder
|
41 |
+
2. Put: `Folder: wp-showhide`
|
42 |
+
3. Activate `WP-ShowHide` Plugin
|
43 |
+
4. No configuration is needed
|
44 |
+
|
45 |
+
= General Usage =
|
46 |
+
1. By default, content within the showhide shortcode will be hidden.
|
47 |
+
2. Example: `[showhide]Press release content goes in here.[/showhide]`
|
48 |
+
3. Default Values: `[showhide type="pressrelease" more_text="Show Press Release (%s More Words)" less_text="Hide Press Release (%s Less Words)" hidden="yes"]`
|
49 |
+
|
50 |
+
1. You can have multiple showhide content within a post or a page, just by having a new type.
|
51 |
+
2. Example: `[showhide type="links" more_text="Show Links (%s More Words)" less_text="Hide Links (%s More Words)"]Links will go in here.[/showhide]`
|
52 |
+
|
53 |
+
1. If you want to set the default visibility to display.
|
54 |
+
2. Example: `[showhide hidden="no"]Press release content goes in here.[/showhide]`
|
55 |
+
|
56 |
+
== Upgrading ==
|
57 |
+
|
58 |
+
1. Deactivate `WP-ShowHide` Plugin
|
59 |
+
2. Open `wp-content/plugins` Folder
|
60 |
+
3. Put/Overwrite: `Folder: wp-showhide`
|
61 |
+
4. Activate `WP-ShowHide` Plugin
|
62 |
+
5. No configuration is needed
|
63 |
+
|
64 |
+
== Upgrade Notice ==
|
65 |
+
|
66 |
+
N/A
|
67 |
+
|
68 |
+
== Screenshots ==
|
69 |
+
|
70 |
+
1. Show More - Press Release
|
71 |
+
2. Hide More - Press Release
|
72 |
+
3. Editor - Short Code
|
73 |
+
|
74 |
+
== Frequently Asked Questions ==
|
75 |
+
|
76 |
+
N/A
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
wp-showhide.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP-ShowHide
|
4 |
+
Plugin URI: http://lesterchan.net/portfolio/programming/php/
|
5 |
+
Description: Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link. By default the content is hidden and user will have to click on the "Show Content" link to toggle it. Similar to what Engadget is doing for their press releases. Example usage: <code>[showhide type="pressrelease"]Press Release goes in here.[/showhide]</code>
|
6 |
+
Version: 1.00
|
7 |
+
Author: Lester 'GaMerZ' Chan
|
8 |
+
Author URI: http://lesterchan.net
|
9 |
+
Text Domain: wp-showhide
|
10 |
+
*/
|
11 |
+
|
12 |
+
|
13 |
+
/*
|
14 |
+
Copyright 2013 Lester Chan (email : lesterchan@gmail.com)
|
15 |
+
|
16 |
+
This program is free software; you can redistribute it and/or modify
|
17 |
+
it under the terms of the GNU General Public License as published by
|
18 |
+
the Free Software Foundation; either version 2 of the License, or
|
19 |
+
(at your option) any later version.
|
20 |
+
|
21 |
+
This program is distributed in the hope that it will be useful,
|
22 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
+
GNU General Public License for more details.
|
25 |
+
|
26 |
+
You should have received a copy of the GNU General Public License
|
27 |
+
along with this program; if not, write to the Free Software
|
28 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
### Function: Enqueue JavaScripts
|
33 |
+
add_action('wp_enqueue_scripts', 'showhide_scripts');
|
34 |
+
function showhide_scripts() {
|
35 |
+
wp_enqueue_script('jquery');
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
### Function: Short Code For Inserting Press Release Into Post
|
40 |
+
add_shortcode('showhide', 'showhide_shortcode');
|
41 |
+
function showhide_shortcode($atts, $content = null) {
|
42 |
+
// Variables
|
43 |
+
$post_id = get_the_id();
|
44 |
+
$word_count = number_format_i18n(sizeof(explode(' ', strip_tags($content))));
|
45 |
+
|
46 |
+
// Extract ShortCode Attributes
|
47 |
+
extract(shortcode_atts(array(
|
48 |
+
'type' => 'pressrelease',
|
49 |
+
'more_text' => __('Show Press Release (%s More Words)'),
|
50 |
+
'less_text' => __('Hide Press Release (%s Less Words)'),
|
51 |
+
'hidden' => 'yes'
|
52 |
+
), $atts));
|
53 |
+
|
54 |
+
// More/Less Text
|
55 |
+
$more_text = sprintf($more_text, $word_count);
|
56 |
+
$less_text = sprintf($less_text, $word_count);
|
57 |
+
|
58 |
+
// Determine Whether To Show Or Hide Press Release
|
59 |
+
$hidden_css = 'display: none;';
|
60 |
+
if($hidden == 'no') {
|
61 |
+
$hidden_css = 'display: block;';
|
62 |
+
$tmp_text = $more_text;
|
63 |
+
$more_text = $less_text;
|
64 |
+
$less_text = $tmp_text;
|
65 |
+
}
|
66 |
+
|
67 |
+
// Format HTML Output
|
68 |
+
$output = '<div class="'.$type.'-link"><a href="#" onclick="showhide_toggle(\''.$type.'\', '.$post_id.', \''.esc_js($more_text).'\', \''.esc_js($less_text).'\'); return false;"><span id="'.$type.'-toggle-'.$post_id.'">'.$more_text.'</span></a></div>';
|
69 |
+
$output .= '<div id="'.$type.'-content-'.$post_id.'" class="'.$type.'-content" style="'.$hidden_css.'">'.$content.'</div>';
|
70 |
+
|
71 |
+
return $output;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
### Function: Add JavaScript To Footer
|
76 |
+
add_action('wp_footer', 'showhide_footer');
|
77 |
+
function showhide_footer() {
|
78 |
+
echo '<script type="text/javascript">'."\n";
|
79 |
+
echo '/* <![CDATA[ */'."\n";
|
80 |
+
echo 'function showhide_toggle(a,b,c,d){jQuery("#"+a+"-content-"+b).toggle();jQuery("#"+a+"-toggle-"+b).text(jQuery("#"+a+"-toggle-"+b).text()==c?d:c)};'."\n";
|
81 |
+
echo '/* ]]> */'."\n";
|
82 |
+
echo '</script>'."\n";
|
83 |
+
}
|
84 |
+
?>
|