Lightweight Accordion

説明

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]

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) Select if you want your accordion to be open by default or not.

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/lightweight-accordion
Lightweight Accordion

インストール

To install this plugin:

  1. Download the plugin
  2. Upload the plugin to the wp-content/plugins directory,
  3. Go to “plugins” in your WordPress admin, then click activate.
  4. 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.

評価

2020年4月14日
This has been a great new addition to my workflow on long-form articles that can offer a better user experience with collapsible accordion-style content to show/hide content. Previously, I was creating these accordions manually every time I wanted to insert one... and this plugin makes it doable in just a few clicks, while also still being super lightweight. Absolutely love it so far.
1件のレビューをすべて表示

貢献者と開発者

Lightweight Accordion はオープンソースソフトウェアです。以下の人々がこのプラグインに貢献しています。

貢献者

“Lightweight Accordion” は3ロケールに翻訳されています。 翻訳者のみなさん、翻訳へのご協力ありがとうございます。

“Lightweight Accordion” をあなたの言語に翻訳しましょう。

開発に興味がありますか ?

コードを閲覧するか、SVN リポジトリをチェックするか、開発ログRSS で購読してみてください。

変更履歴

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.