Описание
This extremely lightweight accordion plugin for WordPress allows you to add collapse elements to posts using a shortcode (via classic editor) or using Gutenberg. By using the details HTML tag and a few lines of CSS this allows for a javascript-free accordion for minimum page load.
Shortcode Usage examples
[lightweight-accordion title="My Accordion"]My Content[/lightweight-accordion]
Additionally you can display the accordion open on load with the accordion_open option.
[lightweight-accordion title="My Accordion" accordion_open=true]My Content[/lightweight-accordion]
You can also change the html tag wrapping the title of the accordion using the title_tag option.
[lightweight-accordion title="My Accordion" title_tag="h3"]My Content[/lightweight-accordion]
If you want to include FAQ schema you can add the schema option and set it to faq.
[lightweight-accordion title="What is your return policy?" schema="faq"]You have 1 week to return your items[/lightweight-accordion]
Shortcode Options
- title (Required Default: null) The title of your accordion will be displayed at the top for users to click. A good example would be to include a user’s question so they could click it for more details.
- content (Required Default: null) Content that will go into your accordion element.
- title_tag (Default: «span») This sets the html tag that wraps the title in the accordion summary. Useful if you want to make it a heading tag for SEO purposes.
- accordion_open (Default: false) Set this to true if you want your accordion to be open by default.
- schema (Default: false) Set this to faq if you’d like FAQ schema to be included.
Additional Details
If you’d like to remove the «lightweight-accordion.css» from being enqueued on your site use the filter below. It’s recommend you style the accordion yourself if you use this filter.
add_filter('lightweight_accordion_include_frontend_stylesheet', '__return_false' );
Блоки
Этот плагин предоставляет 1 блок.
- Lightweight Accordion
Установка
To install this plugin:
- Download the plugin
- Upload the plugin to the wp-content/plugins directory,
- Go to «plugins» in your WordPress admin, then click activate.
- Add the shortcode where you want the accordion to appear. Likewise in Gutenberg you can find the «Lightweight Accordion» block under the «formatting» section in the block selector.
Отзывы
Участники и разработчики
«Lightweight Accordion» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:
Участники«Lightweight Accordion» переведён на 3 языка. Благодарим переводчиков за их работу.
Перевести «Lightweight Accordion» на ваш язык.
Заинтересованы в разработке?
Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.
Журнал изменений
1.3.3
- CSS style compatibility fix for some themes
1.3.2
- Tested up to WordPress 5.6.
- Bug fix in Gutenberg editor styles.
1.3.1
- Added a slight opacity change animation when opening accordions.
1.3.0
- Ability to add FAQ schema to a collapsible using the new ‘schema’ option in the shortcode or dropdown in the Gutenberg editor.
- Bug fixes for PHP warnings.
1.2.0
- Better Gutenberg editor styles to tell what is inside a collapsible.
- Tested up to WordPress 5.5.
1.1.1
- Bug fix: now runs wpautop() on the entire contents of the accordion (so the first paragraph won’t be missing a p tag now)
1.1.0
-
New filter to denqueue the lightweight accordion CSS from the frontend.
add_filter(‘lightweight_accordion_include_frontend_stylesheet’, ‘__return_false’ );
1.0.0
- Initial Release.