humanmade/query-filter
Composer 安装命令:
composer require humanmade/query-filter
包简介
Query Loop Block filters
README 文档
README
This plugin allows you to easily add filters to any query loop block.
Provides 2 new blocks that can be added within a query loop block to allow filtering by either post type or a taxonomy. Also supports using the core search block to allow you to search.
Compatible with both the core query loop block and the Advanced query loop plugin (In fact, in order to use post type filters, use of the Advanced Query Loop plugin is required).
Easy to use and lightweight, built using the WordPress Interactivity API.
Usage
- Add a query block. This can anyhere that the query block is supported e.g. page, template, or pattern.
- Add one of the filter blocks and configure as required:
- Taxonomy filter. Select which taxonomy to to use, customise the label (and whether it's shown), and customise the text used when none is selected.
- Post type filter. Customise the label (and whether it's shown), as well as the text used when no filter is applied.
- Search block. No extra options.
Installation
Using Composer
This plugin is available on packagist.
composer require humanmade/query-filter
Manually from Github.
- Download the plugin from the GitHub repository.
- Upload the plugin to your site's
wp-content/pluginsdirectory. - Activate the plugin from the WordPress admin.
Built assets are not committed to main. Manual or Composer installs should track the release branch (or a tagged release), which contains the compiled build directory.
Local Development
This project uses wp-env to run a lightweight, containerized WordPress instance at localhost:3031 for testing purposes. The default username for the localhost environment is admin, with the password password.
These commands can be used to interact with the environment:
| Command | Purpose |
|---|---|
npm run env:start |
Start the local environment at http://localhost:3031 |
npm run env:stop |
Turn off the local environment |
npm run env:cli -- wp ... |
Run WP-CLI commands within the environment |
npm run env:logs |
Open (and tail) the error logs for the application‡ |
npm run env:db |
Open the database in the mysql command line |
npm run env:destroy |
Fully destroy the local environment (deletes container database) |
‡ This command deliberately filters out GET/OPTIONS/HEAD/POST/PUT access log entries
Release Process
Merges to main automatically build to the release branch. A project may track the release branch using Composer to pull in the latest built beta version.
Commits on the release branch may be tagged for installation via Packagist and marked as releases in GitHub for manual download, using a manually-dispatched "Tag and Release" GH Actions workflow.
To tag a new release:
- Choose the target version number using semantic versioning.
- Check out a
prepare-v#.#.#branch and bump theVersionin the query-filter.php PHPDoc header. - Open a pull request titled "Prepare release v#.#.#".
- Review and merge the "Prepare release" pull request.
- Wait for the
releasebranch to update with the build that includes the new version number. - On the "Tag and Release" GH Action page:
- Click "Run workflow" in the
workflow_dispatchbanner. - Fill out the "Version tag" field with your target version number. This must match the
Versioninquery-filter.php. Use the formatv#.#.#. - Click "Run workflow" to apply the specified tag to the
releasebranch.
- Click "Run workflow" in the
Once the workflow completes, the new version is tagged and listed in releases.
humanmade/query-filter 适用场景与选型建议
humanmade/query-filter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15.12k 次下载、GitHub Stars 达 117, 最近一次更新时间为 2024 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 humanmade/query-filter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 humanmade/query-filter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 117
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2024-09-06