Version Description
- Added global HTML tag setting for accordion item titles
Download this release
Release Info
Developer | philbuchanan |
Plugin | Accordion Shortcodes |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.3
- accordion-shortcodes.php +8 -4
- accordion.min.js +1 -1
- languages/default.po +10 -6
- readme.txt +19 -5
accordion-shortcodes.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Accordion Shortcodes
|
4 |
* Description: Adds a few shortcodes to allow for accordion dropdowns.
|
5 |
-
* Version: 1.
|
6 |
* Author: Phil Buchanan
|
7 |
* Author URI: http://philbuchanan.com
|
8 |
*/
|
@@ -13,6 +13,7 @@ if (!class_exists('Accordion_Shortcodes')) :
|
|
13 |
class Accordion_Shortcodes {
|
14 |
|
15 |
static $add_script;
|
|
|
16 |
|
17 |
function __construct() {
|
18 |
|
@@ -47,7 +48,7 @@ class Accordion_Shortcodes {
|
|
47 |
static function register_script() {
|
48 |
|
49 |
$min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
|
50 |
-
wp_register_script('accordion-shortcodes-script', plugins_url('accordion' . $min . '.js', __FILE__), array('jquery'), '1.
|
51 |
|
52 |
}
|
53 |
|
@@ -68,6 +69,7 @@ class Accordion_Shortcodes {
|
|
68 |
self::$add_script = true;
|
69 |
|
70 |
extract(shortcode_atts(array(
|
|
|
71 |
'autoclose' => true,
|
72 |
'openfirst' => false,
|
73 |
'openall' => false,
|
@@ -85,6 +87,8 @@ class Accordion_Shortcodes {
|
|
85 |
);
|
86 |
wp_localize_script('accordion-shortcodes-script', 'accordionSettings', $script_data);
|
87 |
|
|
|
|
|
88 |
return '<div class="accordion">' . do_shortcode($content) . '</div>';
|
89 |
|
90 |
}
|
@@ -94,13 +98,13 @@ class Accordion_Shortcodes {
|
|
94 |
|
95 |
extract(shortcode_atts(array(
|
96 |
'title' => '',
|
97 |
-
'tag'
|
98 |
), $atts, 'accordion-item'));
|
99 |
|
100 |
return sprintf('<%3$s class="accordion-title">%1$s</%3$s><div class="accordion-content">%2$s</div>',
|
101 |
$title ? $title : '<span style="color:red;">' . __('Please enter a title attribute: [accordion-item title="Item title"]', 'accordion_shortcodes') . '</span>',
|
102 |
do_shortcode($content),
|
103 |
-
$tag
|
104 |
);
|
105 |
|
106 |
}
|
2 |
/**
|
3 |
* Plugin Name: Accordion Shortcodes
|
4 |
* Description: Adds a few shortcodes to allow for accordion dropdowns.
|
5 |
+
* Version: 1.3
|
6 |
* Author: Phil Buchanan
|
7 |
* Author URI: http://philbuchanan.com
|
8 |
*/
|
13 |
class Accordion_Shortcodes {
|
14 |
|
15 |
static $add_script;
|
16 |
+
static $tag;
|
17 |
|
18 |
function __construct() {
|
19 |
|
48 |
static function register_script() {
|
49 |
|
50 |
$min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
|
51 |
+
wp_register_script('accordion-shortcodes-script', plugins_url('accordion' . $min . '.js', __FILE__), array('jquery'), '1.3', true);
|
52 |
|
53 |
}
|
54 |
|
69 |
self::$add_script = true;
|
70 |
|
71 |
extract(shortcode_atts(array(
|
72 |
+
'tag' => 'h3',
|
73 |
'autoclose' => true,
|
74 |
'openfirst' => false,
|
75 |
'openall' => false,
|
87 |
);
|
88 |
wp_localize_script('accordion-shortcodes-script', 'accordionSettings', $script_data);
|
89 |
|
90 |
+
self::$tag = $tag;
|
91 |
+
|
92 |
return '<div class="accordion">' . do_shortcode($content) . '</div>';
|
93 |
|
94 |
}
|
98 |
|
99 |
extract(shortcode_atts(array(
|
100 |
'title' => '',
|
101 |
+
'tag' => ''
|
102 |
), $atts, 'accordion-item'));
|
103 |
|
104 |
return sprintf('<%3$s class="accordion-title">%1$s</%3$s><div class="accordion-content">%2$s</div>',
|
105 |
$title ? $title : '<span style="color:red;">' . __('Please enter a title attribute: [accordion-item title="Item title"]', 'accordion_shortcodes') . '</span>',
|
106 |
do_shortcode($content),
|
107 |
+
$tag ? $tag : self::$tag
|
108 |
);
|
109 |
|
110 |
}
|
accordion.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
!function(o){"use strict";var e=o(".accordion-title"),s=o(".accordion-content").hide(),n=o(".accordion-content:first-of-type"),t=250,i={autoClose:!0,openFirst:!1,openAll:!1,clickToClose:!1,scroll:!1};"undefined"!=typeof accordionSettings&&(i=accordionSettings),i.openAll?(s.show(),e.addClass("open")):i.openFirst&&(n.prev().addClass("open"),n.slideDown(t)),e.click(function(){return o(this).hasClass("open")?i.clickToClose&&(o(this).next().slideUp(t),o(this).removeClass("open")):(i.autoClose&&(s.slideUp(t),e.removeClass("open")),o(this).next().slideDown(t,function(){i.scroll&&o("html, body").animate({scrollTop:o(this).prev().offset().top},t)}),o(this).addClass("open")),!1})}(jQuery);
|
languages/default.po
CHANGED
@@ -1,24 +1,28 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Accordion Shortcodes\n"
|
4 |
-
"POT-Creation-Date: 2014-
|
5 |
-
"PO-Revision-Date: 2014-
|
6 |
"Last-Translator: Phil Buchanan <info@philbuchanan.com>\n"
|
7 |
"Language-Team: \n"
|
|
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"X-Generator: Poedit 1.
|
12 |
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
|
13 |
"X-Poedit-Basepath: .\n"
|
14 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
15 |
-
"Language: en_CA\n"
|
16 |
"X-Poedit-SearchPath-0: ..\n"
|
17 |
|
18 |
-
#: ../accordion-shortcodes.php:
|
19 |
msgid "Please enter a title attribute: [accordion-item title=\"Item title\"]"
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: ../accordion-shortcodes.php:
|
|
|
|
|
|
|
|
|
23 |
msgid "Documentation"
|
24 |
msgstr ""
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Accordion Shortcodes\n"
|
4 |
+
"POT-Creation-Date: 2014-04-21 15:59-0500\n"
|
5 |
+
"PO-Revision-Date: 2014-04-21 15:59-0500\n"
|
6 |
"Last-Translator: Phil Buchanan <info@philbuchanan.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
+
"Language: en_CA\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.7\n"
|
13 |
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
|
14 |
"X-Poedit-Basepath: .\n"
|
15 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
|
16 |
"X-Poedit-SearchPath-0: ..\n"
|
17 |
|
18 |
+
#: ../accordion-shortcodes.php:106
|
19 |
msgid "Please enter a title attribute: [accordion-item title=\"Item title\"]"
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: ../accordion-shortcodes.php:109
|
23 |
+
msgid "Close"
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: ../accordion-shortcodes.php:119
|
27 |
msgid "Documentation"
|
28 |
msgstr ""
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate Link: http://philbuchanan.com/
|
|
5 |
Tags: accordion, accordions, shortcodes
|
6 |
Requires at least: 3.3
|
7 |
Tested up to: 3.9
|
8 |
-
Stable tag: 1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -72,13 +72,19 @@ There are a few [advances settings](http://wordpress.org/plugins/accordion-short
|
|
72 |
|
73 |
= Why isn't the JavaScript file loading on my site? =
|
74 |
|
75 |
-
This is most likely caused by a poorly coded theme.
|
76 |
|
77 |
= How can I change the look of the accordion? =
|
78 |
|
79 |
-
No CSS is added by default to the accordion.
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
== Other Notes ==
|
84 |
|
@@ -118,13 +124,18 @@ There are a few advanced settings you can add to the opening accordion shortcode
|
|
118 |
|
119 |
**scroll**: Sets whether to scroll to the title when it's clicked open. This is useful if you have a lot of content within your accordion items. Set `scroll="true/false"` on the opening accordion tag like this: `[accordion scroll="true"]`. Default is `false`.
|
120 |
|
121 |
-
|
|
|
|
|
122 |
|
123 |
= Issues/Suggestions =
|
124 |
|
125 |
For bug reports or feature requests or if you'd like to contribute to the plugin you can check everything out on [Github](https://github.com/philbuchanan/Accordion-Shortcodes/).
|
126 |
|
127 |
== Changelog ==
|
|
|
|
|
|
|
128 |
= 1.2.4 =
|
129 |
* Compatibility with WordPress 3.9
|
130 |
|
@@ -175,6 +186,9 @@ For bug reports or feature requests or if you'd like to contribute to the plugin
|
|
175 |
* Initial release
|
176 |
|
177 |
== Upgrade Notice ==
|
|
|
|
|
|
|
178 |
= 1.2.4 =
|
179 |
Compatibility with WordPress 3.9.
|
180 |
|
5 |
Tags: accordion, accordions, shortcodes
|
6 |
Requires at least: 3.3
|
7 |
Tested up to: 3.9
|
8 |
+
Stable tag: 1.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
72 |
|
73 |
= Why isn't the JavaScript file loading on my site? =
|
74 |
|
75 |
+
This is most likely caused by a poorly coded theme. This plugin makes use of the `wp_footer()` function to load the JavaScript file and it's dependancy (jQuery). Check your theme to ensure that the `wp_footer()` function is being called right before the closing `</body>` tag in your themes footer.php file.
|
76 |
|
77 |
= How can I change the look of the accordion? =
|
78 |
|
79 |
+
No CSS is added by default to the accordion. The accodion should look fine with every theme.
|
80 |
|
81 |
+
That said, you can change the looking of the accordion as long as you are comfortable with editing your theme's stylesheet. If you are familiar with that process, you can add some [CSS](http://wordpress.org/plugins/accordion-shortcodes/other_notes/#Other-Notes) to make the accordion look the way you want.
|
82 |
+
|
83 |
+
= Can I use other shortcodes inside each accordion item? =
|
84 |
+
|
85 |
+
Absolutely! You can use any of the WordPress format settings and headings as well.
|
86 |
+
|
87 |
+
You cannot, however nest an accordion within another accordion. This is a limitation of how WordPress processes shortcodes.
|
88 |
|
89 |
== Other Notes ==
|
90 |
|
124 |
|
125 |
**scroll**: Sets whether to scroll to the title when it's clicked open. This is useful if you have a lot of content within your accordion items. Set `scroll="true/false"` on the opening accordion tag like this: `[accordion scroll="true"]`. Default is `false`.
|
126 |
|
127 |
+
**tag**: Set the global HTML tag to use for all accordion titles. Set `tag="h2"` on the opening accordion tag like this: `[accordion tag="h2"]`. Default is `h3`.
|
128 |
+
|
129 |
+
You can also set the HTML tag for the titles of each accordion item individually by adding `tag="tagname"` to each `[accordion-item]` shortcode. Make sure to **not** include the angle brackets around the tag name. Example: to use `<h2>` instead of the default `<h3>` tag: `[accordion-item title="Item title" tag="h2"]Item content[/accordion-item]`. Using a tag attribue on an individual accordion item will override the global setting.
|
130 |
|
131 |
= Issues/Suggestions =
|
132 |
|
133 |
For bug reports or feature requests or if you'd like to contribute to the plugin you can check everything out on [Github](https://github.com/philbuchanan/Accordion-Shortcodes/).
|
134 |
|
135 |
== Changelog ==
|
136 |
+
= 1.3 =
|
137 |
+
* Added global HTML tag setting for accordion item titles
|
138 |
+
|
139 |
= 1.2.4 =
|
140 |
* Compatibility with WordPress 3.9
|
141 |
|
186 |
* Initial release
|
187 |
|
188 |
== Upgrade Notice ==
|
189 |
+
= 1.3 =
|
190 |
+
Added global HTML tag setting for accordion item titles.
|
191 |
+
|
192 |
= 1.2.4 =
|
193 |
Compatibility with WordPress 3.9.
|
194 |
|