ralfhortt / query-loop-post-picker
A WordPress plugin that adds post selection and event date controls to Query blocks.
Package info
github.com/Horttcore/query-loop-post-picker
Language:TypeScript
Type:wordpress-plugin
pkg:composer/ralfhortt/query-loop-post-picker
Requires
- php: >=8.1
README
Query Loop Post Picker adds editor controls for selecting specific posts and filtering event queries in the WordPress block editor.
Features
- Select posts for a Query block with a searchable token field.
- Preserve the selected post order with the Query block's
includeordering. - Filter event queries by a quick date range or custom start dates.
- Show only events related to the current staff member when editing staff templates.
- Loads only in the block editor and uses WordPress core data and components.
Requirements
- WordPress 6.1 or newer
- PHP 8.1 or newer
- The WordPress REST API must expose the selected post type.
Installation
- Download or clone this repository into
wp-content/plugins/query-loop-post-picker. - Run
npm installandnpm run buildif the built assets are not included in your package. - Activate Query Loop Post Picker from the WordPress Plugins screen.
- Add or edit a Query Loop block in the block editor.
The plugin does not add a frontend asset. Its controls are registered through enqueue_block_editor_assets.
Development
Install dependencies and build the editor script:
npm install npm run build
For watch mode during development:
npm start
The generated files are written to build/.
Query Attributes
The picker writes these attributes to the Query block when applicable:
includeandorderBy: "include"for selected posts.eventDateRangefor a predefined event date range.eventStartAfterandeventStartBeforefor custom event dates.showRelatedEventsOfStafffor staff-related event queries.
The related-events option only appears for event queries in a staff context and is intended to be paired with a server-side query filter that handles this attribute.
License
GPL-2.0-or-later