Shortdark Software Development

Javascript CSS Accordion

Development 22nd Dec 2019. Time to read: 1 min

WordpressPHPJavascriptCSS

I was having trouble finding a WordPress plugin that would give me an Accordion on a particular WordPress website. Either jQuery was not in the required version range or there was some conflict with one of the other plugins. So, I decided to make my own plugin!

How do I add an Accordion to WordPress?

This plugin is a standalone plugin. It uses pure javascript, not jQuery, so it should work on any WordPress website. Also, the CSS is plain too and does not require any CSS libraries such as Bootstrap.

Here are some examples of an HTML Accordion using this WordPress plugin...

[sdjca id="1" title="hello" content="world"]

[sdjca id="2" title="How can I use an Accordion on my WordPress blog?" content="It's easy with the brand new plugin from Shortdark... Javascript CSS Accordion!!"]

This plugin, at the time of writing is brand new, so it looks like there are some formatting issues on this website, but these will be ironed out shortly.

To find out more and download the plugin see below...

How do I use the Javascript CSS Accordion plugin?

After installing and activating you need to insert some shortcode into your WordPress post or pages.

The shortcode looks like this...

[sdjca id="" title="" content=""]

So, to use it you might populate it like this...

[sdjca id="1" title="Hello" content="World"]

If you have more than one accordion on a post/page each "id" would need to be unique. So, if the first one has id="1", the next one could be id="2", and so on.