Accordion Shortcodes - Version 2.1.1

Version Description

  • FIXED: An issue where openfirst would not work if title tag was set to div
  • FIXED: An issue where title tag setting was not respected when using multiple accordions on one page
Download this release

Release Info

Developer philbuchanan
Plugin Icon 128x128 Accordion Shortcodes
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1 to 2.1.1

accordion-shortcodes.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /**
3
  * Plugin Name: Accordion Shortcodes
4
- * Description: Adds a few shortcodes to allow for accordion dropdowns.
5
- * Version: 2.1
6
  * Author: Phil Buchanan
7
  * Author URI: http://philbuchanan.com
8
  */
@@ -14,7 +14,7 @@ if (!class_exists('Accordion_Shortcodes')) :
14
 
15
  class Accordion_Shortcodes {
16
 
17
- private $plugin_version = '2.1';
18
  private $add_script = false;
19
  private $script_data = array();
20
  private $id = 0;
@@ -61,6 +61,7 @@ class Accordion_Shortcodes {
61
 
62
  wp_enqueue_script('accordion-shortcodes-script');
63
 
 
64
  wp_localize_script('accordion-shortcodes-script', 'accordionShortcodesSettings', $this->script_data);
65
  }
66
 
@@ -98,13 +99,20 @@ class Accordion_Shortcodes {
98
  ), $atts, 'accordion'));
99
 
100
  // Set global HTML tag names
 
 
 
 
 
101
  if ($semantics == 'dl') {
102
  $this->wrapper_tag = 'dl';
103
  $this->title_tag = 'dt';
104
  $this->content_tag = 'dd';
105
  }
106
-
107
- if ($tag) $this->title_tag = $this->check_html_tag($tag);
 
 
108
 
109
  // Set settings object (for use in JavaScript)
110
  $script_data = array(
@@ -116,7 +124,7 @@ class Accordion_Shortcodes {
116
  'scroll' => $scroll
117
  );
118
 
119
- // Add this instances settings to script data array
120
  $this->script_data[] = $script_data;
121
 
122
  return sprintf('<%2$s id="%3$s" class="accordion no-js%4$s">%1$s</%2$s>',
1
  <?php
2
  /**
3
  * Plugin Name: Accordion Shortcodes
4
+ * Description: Shortcodes for creating responsive accordion drop-downs.
5
+ * Version: 2.1.1
6
  * Author: Phil Buchanan
7
  * Author URI: http://philbuchanan.com
8
  */
14
 
15
  class Accordion_Shortcodes {
16
 
17
+ private $plugin_version = '2.1.1';
18
  private $add_script = false;
19
  private $script_data = array();
20
  private $id = 0;
61
 
62
  wp_enqueue_script('accordion-shortcodes-script');
63
 
64
+ // Output accordions settings JavaScript variable
65
  wp_localize_script('accordion-shortcodes-script', 'accordionShortcodesSettings', $this->script_data);
66
  }
67
 
99
  ), $atts, 'accordion'));
100
 
101
  // Set global HTML tag names
102
+ // Set title HTML tag
103
+ if ($tag) $this->title_tag = $this->check_html_tag($tag);
104
+ else $this->title_tag = 'h3';
105
+
106
+ // Set wrapper HTML tags
107
  if ($semantics == 'dl') {
108
  $this->wrapper_tag = 'dl';
109
  $this->title_tag = 'dt';
110
  $this->content_tag = 'dd';
111
  }
112
+ else {
113
+ $this->wrapper_tag = 'div';
114
+ $this->content_tag = 'div';
115
+ }
116
 
117
  // Set settings object (for use in JavaScript)
118
  $script_data = array(
124
  'scroll' => $scroll
125
  );
126
 
127
+ // Add this shortcodes settings instance to the global script data array
128
  $this->script_data[] = $script_data;
129
 
130
  return sprintf('<%2$s id="%3$s" class="accordion no-js%4$s">%1$s</%2$s>',
accordion.js CHANGED
@@ -14,9 +14,9 @@
14
 
15
  var allTitles = this.children('.accordion-title'),
16
  allPanels = this.children('.accordion-content').hide(),
17
- firstTitle = this.children('.accordion-title:first-of-type'),
18
- firstPanel = this.children('.accordion-content:first-of-type'),
19
- selected = $(window.location.hash),
20
  duration = 250,
21
  settings = $.extend({
22
  // Set default settings
@@ -34,17 +34,17 @@
34
  settings.scrollOffset = Math.floor(parseInt(settings.scroll)) | 0;
35
 
36
  // Should any accordions be opened on load?
37
- if (selected.length && selected.hasClass('accordion-title')) {
38
- selected.next().slideDown(duration);
39
- selected.addClass('open');
40
  }
41
  else if (settings.openAll) {
42
  allPanels.show();
43
  allTitles.addClass('open');
44
  }
45
  else if (settings.openFirst) {
46
- firstPanel.slideDown(duration);
47
  firstTitle.addClass('open');
 
48
  }
49
 
50
  // Add event listener
@@ -79,14 +79,14 @@
79
 
80
  // Listen for hash changes (in page jump links for accordions)
81
  $(window).on('hashchange', function() {
82
- selected = $(window.location.hash);
83
 
84
- if (selected.length && selected.hasClass('accordion-title')) {
85
  allPanels.slideUp(duration);
86
  allTitles.removeClass('open');
87
- selected.addClass('open');
88
 
89
- selected.next().slideDown(duration, function() {
90
  $('html, body').animate({
91
  scrollTop: $(this).prev().offset().top - settings.scrollOffset
92
  }, duration);
14
 
15
  var allTitles = this.children('.accordion-title'),
16
  allPanels = this.children('.accordion-content').hide(),
17
+ firstTitle = allTitles.first(),
18
+ firstPanel = allPanels.first(),
19
+ selectedId = $(window.location.hash),
20
  duration = 250,
21
  settings = $.extend({
22
  // Set default settings
34
  settings.scrollOffset = Math.floor(parseInt(settings.scroll)) | 0;
35
 
36
  // Should any accordions be opened on load?
37
+ if (selectedId.length && selectedId.hasClass('accordion-title')) {
38
+ selectedId.addClass('open');
39
+ selectedId.next().slideDown(duration);
40
  }
41
  else if (settings.openAll) {
42
  allPanels.show();
43
  allTitles.addClass('open');
44
  }
45
  else if (settings.openFirst) {
 
46
  firstTitle.addClass('open');
47
+ firstPanel.slideDown(duration);
48
  }
49
 
50
  // Add event listener
79
 
80
  // Listen for hash changes (in page jump links for accordions)
81
  $(window).on('hashchange', function() {
82
+ selectedId = $(window.location.hash);
83
 
84
+ if (selectedId.length && selectedId.hasClass('accordion-title')) {
85
  allPanels.slideUp(duration);
86
  allTitles.removeClass('open');
87
+ selectedId.addClass('open');
88
 
89
+ selectedId.next().slideDown(duration, function() {
90
  $('html, body').animate({
91
  scrollTop: $(this).prev().offset().top - settings.scrollOffset
92
  }, duration);
accordion.min.js CHANGED
@@ -1 +1 @@
1
- (function(e){"use strict";var t,n;e.fn.accordionShortcodes=function(t){var n=this.children(".accordion-title"),r=this.children(".accordion-content").hide(),i=this.children(".accordion-title:first-of-type"),s=this.children(".accordion-content:first-of-type"),o=e(window.location.hash),u=250,a=e.extend({autoClose:true,openFirst:false,openAll:false,clickToClose:false,scroll:false},t);e(".accordion").removeClass("no-js");a.scrollOffset=Math.floor(parseInt(a.scroll))|0;if(o.length&&o.hasClass("accordion-title")){o.next().slideDown(u);o.addClass("open")}else if(a.openAll){r.show();n.addClass("open")}else if(a.openFirst){s.slideDown(u);i.addClass("open")}n.click(function(){if(!e(this).hasClass("open")){if(a.autoClose){r.slideUp(u);n.removeClass("open")}e(this).next().slideDown(u,function(){if(a.scroll){e("html, body").animate({scrollTop:e(this).prev().offset().top-a.scrollOffset},u)}});e(this).addClass("open")}else if(a.clickToClose){e(this).next().slideUp(u);e(this).removeClass("open")}return false});e(window).on("hashchange",function(){o=e(window.location.hash);if(o.length&&o.hasClass("accordion-title")){r.slideUp(u);n.removeClass("open");o.addClass("open");o.next().slideDown(u,function(){e("html, body").animate({scrollTop:e(this).prev().offset().top-a.scrollOffset},u)})}});return this};for(var t=0;t<accordionShortcodesSettings.length;t+=1){n=accordionShortcodesSettings[t];e("#"+n.id).accordionShortcodes(n)}})(jQuery)
1
+ (function(e){"use strict";var t,n;e.fn.accordionShortcodes=function(t){var n=this.children(".accordion-title"),r=this.children(".accordion-content").hide(),i=n.first(),s=r.first(),o=e(window.location.hash),u=250,a=e.extend({autoClose:true,openFirst:false,openAll:false,clickToClose:false,scroll:false},t);e(".accordion").removeClass("no-js");a.scrollOffset=Math.floor(parseInt(a.scroll))|0;if(o.length&&o.hasClass("accordion-title")){o.addClass("open");o.next().slideDown(u)}else if(a.openAll){r.show();n.addClass("open")}else if(a.openFirst){i.addClass("open");s.slideDown(u)}n.click(function(){if(!e(this).hasClass("open")){if(a.autoClose){r.slideUp(u);n.removeClass("open")}e(this).next().slideDown(u,function(){if(a.scroll){e("html, body").animate({scrollTop:e(this).prev().offset().top-a.scrollOffset},u)}});e(this).addClass("open")}else if(a.clickToClose){e(this).next().slideUp(u);e(this).removeClass("open")}return false});e(window).on("hashchange",function(){o=e(window.location.hash);if(o.length&&o.hasClass("accordion-title")){r.slideUp(u);n.removeClass("open");o.addClass("open");o.next().slideDown(u,function(){e("html, body").animate({scrollTop:e(this).prev().offset().top-a.scrollOffset},u)})}});return this};for(var t=0;t<accordionShortcodesSettings.length;t+=1){n=accordionShortcodesSettings[t];e("#"+n.id).accordionShortcodes(n)}})(jQuery)
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate Link: http://philbuchanan.com/
5
  Tags: accordion, accordions, shortcodes, responsive accordions, accordions plugin, jquery accordions, accordions short-code, accordions plugin wordpress, accordions plugin jquery
6
  Requires at least: 3.3
7
  Tested up to: 4.1
8
- Stable tag: 2.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -185,6 +185,10 @@ Thank you to [dgrevink](https://github.com/dgrevink) for his support in developi
185
  3. The Accordion Item shortcode insertion dialog box
186
 
187
  == Changelog ==
 
 
 
 
188
  = 2.1 =
189
  * NEW: Use multiple accordions on a single page! Each shortcode will now respect its own individual settings.
190
  * Now compatible up to WordPress 4.1
@@ -203,6 +207,9 @@ Thank you to [dgrevink](https://github.com/dgrevink) for his support in developi
203
  * FIXED: A few incredibly small bugs/annoyances
204
 
205
  == Upgrade Notice ==
 
 
 
206
  = 2.1 =
207
  This update brings the much request support for multiple accordions on a single page! Each shortcode will now respect its own individual settings.
208
 
5
  Tags: accordion, accordions, shortcodes, responsive accordions, accordions plugin, jquery accordions, accordions short-code, accordions plugin wordpress, accordions plugin jquery
6
  Requires at least: 3.3
7
  Tested up to: 4.1
8
+ Stable tag: 2.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
185
  3. The Accordion Item shortcode insertion dialog box
186
 
187
  == Changelog ==
188
+ = 2.1.1 =
189
+ * FIXED: An issue where openfirst would not work if title tag was set to div
190
+ * FIXED: An issue where title tag setting was not respected when using multiple accordions on one page
191
+
192
  = 2.1 =
193
  * NEW: Use multiple accordions on a single page! Each shortcode will now respect its own individual settings.
194
  * Now compatible up to WordPress 4.1
207
  * FIXED: A few incredibly small bugs/annoyances
208
 
209
  == Upgrade Notice ==
210
+ = 2.1.1 =
211
+ Fixes a few minor issues accidentally introduced in the 2.1 update.
212
+
213
  = 2.1 =
214
  This update brings the much request support for multiple accordions on a single page! Each shortcode will now respect its own individual settings.
215
 
tinymce/tinymce-plugin.js CHANGED
@@ -139,7 +139,7 @@
139
  longname: 'Accordion Buttons',
140
  author: 'Phil Buchanan',
141
  authorurl: 'http://philbuchanan.com/',
142
- version: '2.1'
143
  };
144
  }
145
  });
139
  longname: 'Accordion Buttons',
140
  author: 'Phil Buchanan',
141
  authorurl: 'http://philbuchanan.com/',
142
+ version: '2.1.1'
143
  };
144
  }
145
  });