WP Manifestindependent plugin directory
manifest / content / wp-effortfulaccordion

Effortful Accordion

A WordPress plugin. Transforms content-with-headings into an accordion, tabbed content or columns.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/bikubi/wp-effortfulaccordion/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress plugin. Transforms content-with-headings into an accordion, tabbed content or columns.

Config

The plugin looks for a configuration file in your theme, since the layout depends on the theme. Put it in the most convenient of following places:

.../wp-content/yourtheme/wp-effortfulaccordion-config.php
.../wp-content/yourtheme/lib/wp-effortfulaccordion-config.php # sage 8
.../wp-content/yourtheme/app/wp-effortfulaccordion-config.php # sage 9

Usage

The main function content_split, as well as the Shortcode, take two optional parameters:

  1. mode, defaults to accordion. Check the code for other values and the markup this produces.
  2. h, which is the HTML heading-level at which the content is split. Range: 1-6, defaults to 2, meaning "split at <h2>s".

Setup implicit/automatic content transformation

To run, say, on each page, or each page with template Foo, filter the_content, running the content through the main function. See config-example.php.

For accordions, define your preferred Bootstrap version (3 and 4 are supported) like so:

define('bootstrap_version', 4);

If you don't use Bootstrap in your theme, you can wp_*_enqueue effortfulaccordion.js and effortfulaccordion.css, which contain the relevant bits. In this case, bootstrap_version must be 3.

Explicit content transformation via Shortcode

Content content content.
[accordion mode="accordion" h="2"]
<h2>First heading<h2>
Content related to the first heading.
<h2>Second heading</h2>
Content related to the second heading.
[/accordion]
More content content content.

TODO

  • Only modes accordion, wrap, outerwrap and doublewrap are tested.
  • Makefile (?) for effortfulaccordion.scss→css