Version Description
- NEW: Use multiple accordions on a single page! Each shortcode will now respect its own individual settings.
- Now compatible up to WordPress 4.1
Download this release
Release Info
Developer | philbuchanan |
Plugin | Accordion Shortcodes |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.1
- accordion-shortcodes.php +49 -38
- accordion.js +94 -73
- accordion.min.js +1 -8
- assets/icon-128x128.png +0 -0
- assets/icon-256x256.png +0 -0
- readme.txt +29 -16
- tinymce/tinymce-plugin.js +8 -8
- tinymce/tinymce.php +1 -1
accordion-shortcodes.php
CHANGED
@@ -2,20 +2,22 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Accordion Shortcodes
|
4 |
* Description: Adds a few shortcodes to allow for accordion dropdowns.
|
5 |
-
* Version: 2.
|
6 |
* Author: Phil Buchanan
|
7 |
* Author URI: http://philbuchanan.com
|
8 |
*/
|
9 |
|
10 |
require_once('tinymce/tinymce.php');
|
11 |
|
12 |
-
|
13 |
if (!class_exists('Accordion_Shortcodes')) :
|
14 |
|
15 |
class Accordion_Shortcodes {
|
16 |
|
17 |
-
private $plugin_version = '2.
|
18 |
-
private $add_script
|
|
|
|
|
19 |
|
20 |
private $wrapper_tag = 'div';
|
21 |
private $title_tag = 'h3';
|
@@ -24,60 +26,65 @@ class Accordion_Shortcodes {
|
|
24 |
function __construct() {
|
25 |
$basename = plugin_basename(__FILE__);
|
26 |
|
27 |
-
|
28 |
load_plugin_textdomain('accordion_shortcodes', false, dirname($basename) . '/languages/');
|
29 |
|
30 |
-
|
31 |
add_action('wp_enqueue_scripts', array($this, 'register_script'));
|
32 |
|
33 |
-
|
34 |
add_shortcode('accordion', array($this, 'accordion_shortcode'));
|
35 |
add_shortcode('accordion-item', array($this, 'accordion_item_shortcode'));
|
36 |
|
37 |
-
|
38 |
add_action('wp_footer', array($this, 'print_script'));
|
39 |
|
40 |
-
|
41 |
add_filter("plugin_action_links_$basename", array($this, 'add_documentation_link'));
|
42 |
|
43 |
-
|
44 |
if (is_admin()) {
|
45 |
$Accordion_Shortcode_Tinymce_Extensions = new Accordion_Shortcode_Tinymce_Extensions;
|
46 |
}
|
47 |
}
|
48 |
|
49 |
-
|
50 |
public function register_script() {
|
51 |
$min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
|
52 |
-
wp_register_script('accordion-shortcodes-script', plugins_url('accordion' . $min . '.js', __FILE__), array('jquery'), $this
|
53 |
}
|
54 |
|
55 |
-
|
56 |
public function print_script() {
|
57 |
-
|
58 |
-
if (!$this
|
59 |
|
60 |
wp_enqueue_script('accordion-shortcodes-script');
|
|
|
|
|
61 |
}
|
62 |
|
63 |
-
|
64 |
private function parse_boolean($value) {
|
65 |
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
66 |
}
|
67 |
|
68 |
-
|
69 |
private function check_html_tag($tag) {
|
70 |
$tag = preg_replace('/\s/', '', $tag);
|
71 |
$tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div');
|
72 |
|
73 |
if (in_array($tag, $tags)) return $tag;
|
74 |
-
else return $this
|
75 |
}
|
76 |
|
77 |
-
|
78 |
public function accordion_shortcode($atts, $content = null) {
|
79 |
-
|
80 |
-
$this
|
|
|
|
|
|
|
81 |
|
82 |
extract(shortcode_atts(array(
|
83 |
'tag' => '',
|
@@ -90,33 +97,37 @@ class Accordion_Shortcodes {
|
|
90 |
'class' => ''
|
91 |
), $atts, 'accordion'));
|
92 |
|
93 |
-
|
94 |
if ($semantics == 'dl') {
|
95 |
-
$this
|
96 |
-
$this
|
97 |
-
$this
|
98 |
}
|
99 |
|
100 |
-
if ($tag) $this
|
101 |
|
102 |
-
|
103 |
$script_data = array(
|
104 |
-
'
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
|
|
108 |
'scroll' => $scroll
|
109 |
);
|
110 |
-
wp_localize_script('accordion-shortcodes-script', 'accordionSettings', $script_data);
|
111 |
|
112 |
-
|
|
|
|
|
|
|
113 |
do_shortcode($content),
|
114 |
-
$this
|
|
|
115 |
$class ? " $class" : ''
|
116 |
);
|
117 |
}
|
118 |
|
119 |
-
|
120 |
public function accordion_item_shortcode($atts, $content = null) {
|
121 |
extract(shortcode_atts(array(
|
122 |
'title' => '',
|
@@ -129,13 +140,13 @@ class Accordion_Shortcodes {
|
|
129 |
$title ? $title : '<span style="color:red;">' . __('Please enter a title attribute', 'accordion_shortcodes') . '</span>',
|
130 |
do_shortcode($content),
|
131 |
$id ? ' id="' . $id . '"' : '',
|
132 |
-
$tag ? $this
|
133 |
-
$this
|
134 |
$class ? " $class" : ''
|
135 |
);
|
136 |
}
|
137 |
|
138 |
-
|
139 |
public function add_documentation_link($links) {
|
140 |
array_push($links, sprintf('<a href="%s">%s</a>',
|
141 |
'http://wordpress.org/plugins/accordion-shortcodes/',
|
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 |
*/
|
9 |
|
10 |
require_once('tinymce/tinymce.php');
|
11 |
|
12 |
+
// Make sure to not redeclare the class
|
13 |
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;
|
21 |
|
22 |
private $wrapper_tag = 'div';
|
23 |
private $title_tag = 'h3';
|
26 |
function __construct() {
|
27 |
$basename = plugin_basename(__FILE__);
|
28 |
|
29 |
+
// Load text domain
|
30 |
load_plugin_textdomain('accordion_shortcodes', false, dirname($basename) . '/languages/');
|
31 |
|
32 |
+
// Register JavaScript
|
33 |
add_action('wp_enqueue_scripts', array($this, 'register_script'));
|
34 |
|
35 |
+
// Add shortcodes
|
36 |
add_shortcode('accordion', array($this, 'accordion_shortcode'));
|
37 |
add_shortcode('accordion-item', array($this, 'accordion_item_shortcode'));
|
38 |
|
39 |
+
// Print script in wp_footer
|
40 |
add_action('wp_footer', array($this, 'print_script'));
|
41 |
|
42 |
+
// Add link to documentation
|
43 |
add_filter("plugin_action_links_$basename", array($this, 'add_documentation_link'));
|
44 |
|
45 |
+
// Add buttons to editor
|
46 |
if (is_admin()) {
|
47 |
$Accordion_Shortcode_Tinymce_Extensions = new Accordion_Shortcode_Tinymce_Extensions;
|
48 |
}
|
49 |
}
|
50 |
|
51 |
+
// Registers the minified accordion JavaScript file
|
52 |
public function register_script() {
|
53 |
$min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
|
54 |
+
wp_register_script('accordion-shortcodes-script', plugins_url('accordion' . $min . '.js', __FILE__), array('jquery'), $this->plugin_version, true);
|
55 |
}
|
56 |
|
57 |
+
// Prints the minified accordion JavaScript file in the footer
|
58 |
public function print_script() {
|
59 |
+
// Check to see if shortcodes are used on page
|
60 |
+
if (!$this->add_script) return;
|
61 |
|
62 |
wp_enqueue_script('accordion-shortcodes-script');
|
63 |
+
|
64 |
+
wp_localize_script('accordion-shortcodes-script', 'accordionShortcodesSettings', $this->script_data);
|
65 |
}
|
66 |
|
67 |
+
// Checks for boolean value
|
68 |
private function parse_boolean($value) {
|
69 |
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
70 |
}
|
71 |
|
72 |
+
// Check for valid HTML tag
|
73 |
private function check_html_tag($tag) {
|
74 |
$tag = preg_replace('/\s/', '', $tag);
|
75 |
$tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div');
|
76 |
|
77 |
if (in_array($tag, $tags)) return $tag;
|
78 |
+
else return $this->title_tag;
|
79 |
}
|
80 |
|
81 |
+
// Accordion wrapper shortcode
|
82 |
public function accordion_shortcode($atts, $content = null) {
|
83 |
+
// The shortcode is used on the page, so load the JavaScript
|
84 |
+
$this->add_script = true;
|
85 |
+
|
86 |
+
// Increment accordion counter
|
87 |
+
$this->id++;
|
88 |
|
89 |
extract(shortcode_atts(array(
|
90 |
'tag' => '',
|
97 |
'class' => ''
|
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(
|
111 |
+
'id' => "accordion-$this->id",
|
112 |
+
'autoClose' => $this->parse_boolean($autoclose),
|
113 |
+
'openFirst' => $this->parse_boolean($openfirst),
|
114 |
+
'openAll' => $this->parse_boolean($openall),
|
115 |
+
'clickToClose' => $this->parse_boolean($clicktoclose),
|
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>',
|
123 |
do_shortcode($content),
|
124 |
+
$this->wrapper_tag,
|
125 |
+
"accordion-$this->id",
|
126 |
$class ? " $class" : ''
|
127 |
);
|
128 |
}
|
129 |
|
130 |
+
// Accordion item shortcode
|
131 |
public function accordion_item_shortcode($atts, $content = null) {
|
132 |
extract(shortcode_atts(array(
|
133 |
'title' => '',
|
140 |
$title ? $title : '<span style="color:red;">' . __('Please enter a title attribute', 'accordion_shortcodes') . '</span>',
|
141 |
do_shortcode($content),
|
142 |
$id ? ' id="' . $id . '"' : '',
|
143 |
+
$tag ? $this->check_html_tag($tag) : $this->title_tag,
|
144 |
+
$this->content_tag,
|
145 |
$class ? " $class" : ''
|
146 |
);
|
147 |
}
|
148 |
|
149 |
+
// Add documentation link on plugin page
|
150 |
public function add_documentation_link($links) {
|
151 |
array_push($links, sprintf('<a href="%s">%s</a>',
|
152 |
'http://wordpress.org/plugins/accordion-shortcodes/',
|
accordion.js
CHANGED
@@ -1,88 +1,109 @@
|
|
1 |
(function($) {
|
2 |
'use strict';
|
3 |
|
4 |
-
var
|
5 |
-
allPanels = $('.accordion-content').hide(),
|
6 |
-
firstPanel = $('.accordion-content:first-of-type'),
|
7 |
-
selectId = $(window.location.hash),
|
8 |
-
duration = 250,
|
9 |
-
settings = {
|
10 |
-
// Set defaults
|
11 |
-
autoClose: true,
|
12 |
-
openFirst: false,
|
13 |
-
openAll: false,
|
14 |
-
clickToClose: false,
|
15 |
-
scroll: false
|
16 |
-
};
|
17 |
|
18 |
-
// Check for accordion settings variable passed from WordPress
|
19 |
-
if (typeof accordionSettings !== 'undefined') {
|
20 |
-
settings = accordionSettings;
|
21 |
-
}
|
22 |
-
|
23 |
-
// Set the scroll offset
|
24 |
-
settings.scrollOffset = Math.floor(parseInt(settings.scroll)) | 0;
|
25 |
|
26 |
-
// Remove no-js class if JavaScript is enabled
|
27 |
-
$('.accordion').removeClass('no-js');
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
allPanels.show();
|
36 |
-
allTitles.addClass('open');
|
37 |
-
}
|
38 |
-
else if (settings.openFirst) {
|
39 |
-
firstPanel.prev().addClass('open');
|
40 |
-
firstPanel.slideDown(duration);
|
41 |
-
}
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
$('html, body').animate({
|
58 |
scrollTop: $(this).prev().offset().top - settings.scrollOffset
|
59 |
}, duration);
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
}
|
64 |
-
// If item is open, and click to close is set, close it
|
65 |
-
else if (settings.clickToClose) {
|
66 |
-
$(this).next().slideUp(duration);
|
67 |
-
$(this).removeClass('open');
|
68 |
-
}
|
69 |
|
70 |
-
return
|
71 |
-
});
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
}, duration);
|
84 |
-
});
|
85 |
-
}
|
86 |
-
});
|
87 |
-
|
88 |
}(jQuery));
|
1 |
(function($) {
|
2 |
'use strict';
|
3 |
|
4 |
+
var i, settings;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
7 |
|
8 |
+
/**
|
9 |
+
* Accordion Shortcodes plugin function
|
10 |
+
*
|
11 |
+
* @param object options Plugin settings to override the defaults
|
12 |
+
*/
|
13 |
+
$.fn.accordionShortcodes = function(options) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
23 |
+
autoClose: true,
|
24 |
+
openFirst: false,
|
25 |
+
openAll: false,
|
26 |
+
clickToClose: false,
|
27 |
+
scroll: false
|
28 |
+
}, options);
|
29 |
+
|
30 |
+
// Remove 'no-js' class since JavaScript is enabled
|
31 |
+
$('.accordion').removeClass('no-js');
|
32 |
+
|
33 |
+
// Set the scroll offset
|
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
|
51 |
+
allTitles.click(function() {
|
52 |
+
// Only open the item if item isn't already open
|
53 |
+
if (!$(this).hasClass('open')) {
|
54 |
+
// Close all accordion items
|
55 |
+
if (settings.autoClose) {
|
56 |
+
allPanels.slideUp(duration);
|
57 |
+
allTitles.removeClass('open');
|
58 |
+
}
|
59 |
+
|
60 |
+
// Open clicked item
|
61 |
+
$(this).next().slideDown(duration, function() {
|
62 |
+
// Scroll page to the title
|
63 |
+
if (settings.scroll) {
|
64 |
+
$('html, body').animate({
|
65 |
+
scrollTop: $(this).prev().offset().top - settings.scrollOffset
|
66 |
+
}, duration);
|
67 |
+
}
|
68 |
+
});
|
69 |
+
$(this).addClass('open');
|
70 |
}
|
71 |
+
// If item is open, and click to close is set, close it
|
72 |
+
else if (settings.clickToClose) {
|
73 |
+
$(this).next().slideUp(duration);
|
74 |
+
$(this).removeClass('open');
|
75 |
+
}
|
76 |
+
|
77 |
+
return false;
|
78 |
+
});
|
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);
|
93 |
+
});
|
94 |
+
}
|
95 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
+
return this;
|
|
|
98 |
|
99 |
+
};
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
// Loop through accordion settings objects
|
104 |
+
for (var i = 0; i < accordionShortcodesSettings.length; i += 1) {
|
105 |
+
settings = accordionShortcodesSettings[i];
|
106 |
+
|
107 |
+
$('#' + settings.id).accordionShortcodes(settings);
|
108 |
+
}
|
|
|
|
|
|
|
|
|
|
|
109 |
}(jQuery));
|
accordion.min.js
CHANGED
@@ -1,8 +1 @@
|
|
1 |
-
(function(
|
2 |
-
settings.scrollOffset=Math.floor(parseInt(settings.scroll))|0;$('.accordion').removeClass('no-js');if(selectId.length&&selectId.hasClass('accordion-title')){selectId.addClass('open');selectId.next().slideDown(duration);}
|
3 |
-
else if(settings.openAll){allPanels.show();allTitles.addClass('open');}
|
4 |
-
else if(settings.openFirst){firstPanel.prev().addClass('open');firstPanel.slideDown(duration);}
|
5 |
-
allTitles.click(function(){if(!$(this).hasClass('open')){if(settings.autoClose){allPanels.slideUp(duration);allTitles.removeClass('open');}
|
6 |
-
$(this).next().slideDown(duration,function(){if(settings.scroll){$('html, body').animate({scrollTop:$(this).prev().offset().top-settings.scrollOffset},duration);}});$(this).addClass('open');}
|
7 |
-
else if(settings.clickToClose){$(this).next().slideUp(duration);$(this).removeClass('open');}
|
8 |
-
return false;});$(window).on('hashchange',function(){selectId=$(window.location.hash);if(selectId.length&&selectId.hasClass('accordion-title')){allPanels.slideUp(duration);allTitles.removeClass('open');selectId.addClass('open');selectId.next().slideDown(duration,function(){$('html, body').animate({scrollTop:$(this).prev().offset().top-settings.scrollOffset},duration);});}});}(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=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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/icon-128x128.png
ADDED
Binary file
|
assets/icon-256x256.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -2,44 +2,50 @@
|
|
2 |
Contributors: philbuchanan
|
3 |
Author URI: http://philbuchanan.com/
|
4 |
Donate Link: http://philbuchanan.com/
|
5 |
-
Tags: accordion, accordions, shortcodes
|
6 |
Requires at least: 3.3
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
|
13 |
|
14 |
== Description ==
|
15 |
-
Adds a few shortcodes to allow for accordion drop-downs.
|
16 |
|
17 |
-
|
|
|
|
|
18 |
|
19 |
= Features =
|
20 |
|
21 |
-
* Adds two shortcodes for adding
|
|
|
22 |
* Two buttons in the TinyMCE editor make it easy to add and configure the accordion shortcodes
|
|
|
23 |
* No default CSS added
|
24 |
* Only adds JavaScript on pages that use the shortcodes
|
25 |
* Support for item IDs and direct links
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
*
|
30 |
-
*
|
31 |
-
*
|
32 |
-
*
|
|
|
|
|
|
|
33 |
|
34 |
= The Shortcodes =
|
35 |
|
36 |
The two shortcodes that are added are:
|
37 |
|
38 |
-
`[accordion]`
|
39 |
|
40 |
and
|
41 |
|
42 |
-
`[accordion-item title=""]`
|
43 |
|
44 |
= Basic Usage Example =
|
45 |
|
@@ -179,6 +185,10 @@ Thank you to [dgrevink](https://github.com/dgrevink) for his support in developi
|
|
179 |
3. The Accordion Item shortcode insertion dialog box
|
180 |
|
181 |
== Changelog ==
|
|
|
|
|
|
|
|
|
182 |
= 2.0.1 =
|
183 |
* NEW: Add a custom CSS classname to your accordion item group or accordion item shortcode
|
184 |
* NEW: Set an integer for scroll property to offset the scrolling by that many pixels
|
@@ -193,6 +203,9 @@ Thank you to [dgrevink](https://github.com/dgrevink) for his support in developi
|
|
193 |
* FIXED: A few incredibly small bugs/annoyances
|
194 |
|
195 |
== Upgrade Notice ==
|
|
|
|
|
|
|
196 |
= 2.0.1 =
|
197 |
WordPress 4.0 compatibility.
|
198 |
|
2 |
Contributors: philbuchanan
|
3 |
Author URI: http://philbuchanan.com/
|
4 |
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 |
|
12 |
+
Shortcodes for creating responsive accordion drop-downs.
|
13 |
|
14 |
== Description ==
|
|
|
15 |
|
16 |
+
Accordion Shortcodes is a simple plugin that adds a few shortcodes for adding accordion drop-downs to your pages.
|
17 |
+
|
18 |
+
The accordions should blend seemlessly with your theme. However, you may want to be able to edit your themes main stylesheet in order to [add some custom styling (CSS)](http://wordpress.org/plugins/accordion-shortcodes/other_notes/#Other-Notes).
|
19 |
|
20 |
= Features =
|
21 |
|
22 |
+
* Adds two shortcodes for adding accordions to your site
|
23 |
+
* Supports multiple accordions with individual settings on a single page
|
24 |
* Two buttons in the TinyMCE editor make it easy to add and configure the accordion shortcodes
|
25 |
+
* Responsive
|
26 |
* No default CSS added
|
27 |
* Only adds JavaScript on pages that use the shortcodes
|
28 |
* Support for item IDs and direct links
|
29 |
+
|
30 |
+
= Optional Features =
|
31 |
+
|
32 |
+
* Open the first accordion item by default
|
33 |
+
* Open all accordion items by default
|
34 |
+
* Disable auto closing of accordion items
|
35 |
+
* Manually close items by clicking the title again
|
36 |
+
* Scroll page to title when it's clicked open
|
37 |
+
* Set the HTML tag for the title element
|
38 |
+
* Change the semantic structure of your accordions (advanced)
|
39 |
|
40 |
= The Shortcodes =
|
41 |
|
42 |
The two shortcodes that are added are:
|
43 |
|
44 |
+
`[accordion]...[/accordion]`
|
45 |
|
46 |
and
|
47 |
|
48 |
+
`[accordion-item title=""]...[/accordion-item]`
|
49 |
|
50 |
= Basic Usage Example =
|
51 |
|
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
|
191 |
+
|
192 |
= 2.0.1 =
|
193 |
* NEW: Add a custom CSS classname to your accordion item group or accordion item shortcode
|
194 |
* NEW: Set an integer for scroll property to offset the scrolling by that many pixels
|
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 |
+
|
209 |
= 2.0.1 =
|
210 |
WordPress 4.0 compatibility.
|
211 |
|
tinymce/tinymce-plugin.js
CHANGED
@@ -46,13 +46,13 @@
|
|
46 |
minWidth: 75,
|
47 |
values: [
|
48 |
{text: '---', value: null},
|
49 |
-
{text: 'h1',
|
50 |
-
{text: 'h2',
|
51 |
-
{text: 'h3',
|
52 |
-
{text: 'h4',
|
53 |
-
{text: 'h5',
|
54 |
-
{text: 'h6',
|
55 |
-
{text: 'p',
|
56 |
{text: 'div', value: 'div'}
|
57 |
]
|
58 |
}
|
@@ -139,7 +139,7 @@
|
|
139 |
longname: 'Accordion Buttons',
|
140 |
author: 'Phil Buchanan',
|
141 |
authorurl: 'http://philbuchanan.com/',
|
142 |
-
version: '2.
|
143 |
};
|
144 |
}
|
145 |
});
|
46 |
minWidth: 75,
|
47 |
values: [
|
48 |
{text: '---', value: null},
|
49 |
+
{text: 'h1', value: 'h1'},
|
50 |
+
{text: 'h2', value: 'h2'},
|
51 |
+
{text: 'h3', value: 'h3'},
|
52 |
+
{text: 'h4', value: 'h4'},
|
53 |
+
{text: 'h5', value: 'h5'},
|
54 |
+
{text: 'h6', value: 'h6'},
|
55 |
+
{text: 'p', value: 'p'},
|
56 |
{text: 'div', value: 'div'}
|
57 |
]
|
58 |
}
|
139 |
longname: 'Accordion Buttons',
|
140 |
author: 'Phil Buchanan',
|
141 |
authorurl: 'http://philbuchanan.com/',
|
142 |
+
version: '2.1'
|
143 |
};
|
144 |
}
|
145 |
});
|
tinymce/tinymce.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
if (!class_exists('Accordion_Shortcode_Tinymce_Extensions')) :
|
5 |
|
6 |
class Accordion_Shortcode_Tinymce_Extensions {
|
1 |
<?php
|
2 |
|
3 |
+
// Make sure to not redeclare the class
|
4 |
if (!class_exists('Accordion_Shortcode_Tinymce_Extensions')) :
|
5 |
|
6 |
class Accordion_Shortcode_Tinymce_Extensions {
|