Linux 软件免费装
Banner图

Search Modal Block

开发者 philhoyt
更新时间 2026年11月26日 05:55
PHP版本: 7.4 及以上
WordPress版本: 7.2
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

modal search block search form popup search

下载

1.3.0 1.3.1 1.0.1 1.2.0 1.1.0 1.3.2

详情介绍:

Search Modal Block adds one block, Search Modal Block, to the inserter. On the page it renders a button with a search icon. Clicking the button opens a modal with a standard WordPress search form that submits to your site's search results. In the block inspector you can set: The modal is a role="dialog" with aria-modal, a title for assistive technology, and a close button. Opening it moves focus into the dialog and locks page scrolling; Escape and the overlay close it. The form uses the theme's wp-block-search and wp-block-button__link classes, so it picks up the same styling as the core Search and Buttons blocks. The front-end script (MicroModal plus the init call, about 3 KB gzipped) loads only on pages that contain the block. The stylesheet is page-scoped on block themes; classic themes load every registered block's styles on every page.

安装:

  1. Install from Plugins > Add New by searching for "Search Modal Block", or upload the plugin folder to /wp-content/plugins/.
  2. Activate the plugin on the Plugins screen.
  3. In the editor, add the Search Modal Block to a header, navigation area, or any other content.

屏幕截图:

  • The open search modal on the front end.

常见问题:

How do I style the button and the form?

The trigger button inherits your theme's button colours. The form reuses the wp-block-search__input and wp-block-button__link classes, so theme.json styles for the Search and Buttons blocks apply to it. For anything else, target the wp-block-ph-search-modal__* classes in your theme's CSS.

Does it work on a subdirectory or multisite install?

Yes. The form action is rewritten on render to the site's home_url(), so the search goes to the right site.

Will updating break blocks I added with an older version?

No. The block carries deprecations for the 1.0.0, 1.1.0, and 1.2.0 markup, so older blocks are migrated when the post is next opened in the editor and keep rendering on the front end until then.

更新日志:

1.3.2 1.3.1 1.3.0 1.2.0 1.1.0 1.0.1 1.0.0