=== Query Blocks ===
Contributors:      itmaroon
Tags:              block, post, taxsonomy, field, query
Requires at least: 6.4
Tested up to:      7.1
Stable tag:        2.4.1
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 8.2.10

This is a collection of blocks that display WordPress posts. It includes blocks for selectively displaying posts, setting selection, pagination, and displaying settings.

== Related Links ==

* [query-blocks:Github](https://github.com/itmaroon/query-blocks)
* [block-class-package:GitHub](https://github.com/itmaroon/block-class-package)  
* [block-class-package:Packagist](https://packagist.org/packages/itmar/block-class-package) 
* [itmar-block-packages:npm](https://www.npmjs.com/package/itmar-block-packages)  
* [itmar-block-packages:GitHub](https://github.com/itmaroon/itmar-block-packages)

== Description ==

When you install this plugin, the following four blocks are registered and can be used not only in the block editor but also in the site editor.

1. Post Pickup
Provides a function to pick up WordPress post data. Internally, it generates a subquery to extract data from the database. The extracted data is selected by selecting the post type and term, and the required fields are rendered by selecting the field. Custom fields can also be selected.

2. Post Filter
This block provides a UI for users to filter Post Pickups specified by ID. There are three types of filtering:
- Provides a filtering function by string search. The search targets are title, excerpt, and body text, but custom fields can also be targeted by selecting an option.
- Provides a filtering function for data posted within a set period. The period can be set to three types: year, month, and day.
- Provides a filtering function by terms set in posts. The terms to be filtered are selected by selecting the taxonomy associated with the post type.

3. Post Pagination
This block provides pagination display of Post Pickup specified by ID.
Two types are available: one that displays the page number and one that moves to the previous or next page. The type that displays the page number has Design Button as an inner block,
and the type that moves to the previous or next page has Design Title as an inner block.
Various customizations are possible by utilizing the design functions of these custom blocks.

4. Post Crumbs
This block displays the filtering information of Post Pickup specified by ID in the form of a breadcrumb list.
The filtering information is based on filtering by Post Filter and is displayed as the text of Design Title.
Therefore, various customizations are possible by using the design function of Design Title.
In addition, when Post Pickup is displayed as a single post, the title of the post is also displayed in addition to the filtering information.

== Installation ==

1. From the WP admin panel, click “Plugins” -> “Add new”.
2. In the browser input box, type “Query Blocks”.
3. Select the “Query Blocks” plugin and click “Install”.
4. Activate the plugin.

OR…

1. Download the plugin from this page.
2. Save the .zip file to a location on your computer.
3. Open the WP admin panel, and click “Plugins” -> “Add new”.
4. Click “upload”.. then browse to the .zip file downloaded from this page.
5. Click “Install”.. and then “Activate plugin”.



== Frequently Asked Questions ==



== Screenshots ==

1. Display multiple posts in Post Pickup
2. Display posts in order of popularity with Post Pickup
3. Display filtering information in breadcrumb format with Post Crumbs
4. Post Filter filter setting screen (period filter is displayed by month)
5. Post Filter filter setting screen (period filter is displayed by year)
6. Post Filter filter setting screen (period filter is displayed by day)
7. Post Pagination page number display
8. Post Pagination forward/backward navigation

== Changelog ==
= 2.4.1 =
- Fixed: the core Post Content block placed in a Post Pickup template now keeps its padding and margin on the front end. The placeholder is rendered with the block's own supports.
- Improved: on translated pages (for example /en/) the Post Filter replaces the labels of taxonomy options with the translated term names, including options that were saved with Japanese labels. This works together with the term name translation of Slug Translater 2.1.0 and does not change the values sent for filtering.

= 2.4.0 =
- Changed: custom-field videos in Post Pickup now autoplay silently, loop and hide playback controls. File videos use inline playback and pause while outside the viewport.
- Fixed: file videos preserve their intrinsic aspect ratio instead of always using a 16:9 player.
- Added: field Video blocks have a "動画の表示" style panel with native, landscape, portrait, mobile (390 x 844) and square ratios. An explicit ratio crops the video from its center. Existing blocks without a ratio keep their native video proportions.
- Improved: YouTube and Vimeo embeds request muted autoplay, looping and hidden controls. YouTube single-video loops include the playlist parameter.

= 2.3.1 =
- Fixed: Post Pickup removes obsolete taxonomy conditions and display choices only after successfully reading the selected post type's registered taxonomies, without stale requests overwriting newer selections.
- Fixed: custom-field button URLs no longer inherit post-filter query parameters; post permalink links continue to retain them.
- Fixed: image custom fields accept image URL strings directly. Non-image URLs and failed media lookups no longer prevent the remaining card content from rendering.
- Fixed: Post Content placeholders preserve WordPress block-support classes and styles when Post Pickup renders article content.

= 2.3.0 =
- Added: Post Pickup has a new card layout, "One design, cards in a row". Set the number of columns (desktop and mobile) and the gap. A last row with fewer cards can be aligned left, center or right. The editor shows the layout, with ghost cards for the other positions.
- Added: custom fields can be shown in a Core Video block (block map: core/video). A file URL becomes a video player, and a YouTube or Vimeo URL becomes an embedded player.
- Added: an empty custom field no longer leaves its sample text, button or video on the page. The element, and a group that becomes empty, are removed.
- Added: ?terms= accepts a term slug as well as a term ID, for example ?terms={"genre":"design"}. Post Crumbs and Post Filter understand it too, so the breadcrumb shows the narrowed term.
- Fixed: if the terms of a taxonomy cannot be read for a post (for example the taxonomy is no longer attached to the post type), the other cards are still shown.
- Improved: rebuilt with the latest shared packages (itmar-block-packages 3.4.0). No configuration changes are required.
- Compatibility: the new settings are saved only when they are used, so blocks that are already saved are not affected.

= 2.2.0 =
- Added: Post Pickup has a new "Order By" setting (Select Query Type: Nomal). You can order by date (default), by "Order" (Page Attributes), by title, or randomly, and choose ascending or descending. Existing blocks keep their current order (newest first) because the setting is saved only when it is used.
- Added: when ordering by "Order" (Page Attributes), posts whose order is 0 (not set) come last, and posts with the same number are sorted by newest date. The post type needs the Page Attributes support.
- Improved: the search endpoint (itmar-rest-api/v1/search) accepts only known "orderby" values and ASC/DESC for "order"; anything else is ignored.
- Note: when a Post Pickup linked to a slider (scroll link) and the slider's own Post Pickup show the same posts, set the same order on both so that the images and the texts match.
- Improved: Japanese translations were added for the new settings.

= 2.1.2 =
- Fixed: images from a gallery field were replaced in the slider, but the sample image still showed because the template image kept its srcset. This happened on sites where the sample image is registered in the media library. The srcset and sizes attributes are now removed when the image is replaced.

= 2.1.1 =
- Post Filter: when a taxonomy has no terms yet (for example right after moving a theme to another site), logged-in users now see a notice explaining why no choices appear. Visitors no longer see an empty group.

= 2.1.0 =
- Rebuilt Post Pickup, Post Filter, Post Pagenation and Post Crumbs with the latest shared packages; colors read the `--itmar-*` role variables.
- Updated the Japanese translation.

= 2.0.4 =
- Colors now read the `--itmar-*` slots provided by Block Collections, with theme-independent fallbacks.
- Post Pagenation imports its shared helpers from `itmar-block-packages/front`.

= 2.0.3 =
- Fixed retrieval of selected ACF group fields when migrated posts do not contain the parent field reference metadata.
- Updated the bundled `itmar-block-packages` dependency to version 3.2.4 so taxonomy filters can load their items on the front end.

= 2.0.2 =
- Composer component fixed.

= 2.0.1 =
- Converted JavaScript to TypeScript.

= 1.1.2 =
- We have taken performance into consideration by limiting the process of rewriting the block contents to only when there is a change in the block contents.

= 1.1.1 =
- Added a data-post-id attribute to each DOM element of front-end post data to record the post ID.

= 1.1.0 =
- Regarding the method of loading composer components, a mechanism has been introduced that does not conflict with other plugins. Accordingly, the composer components have been updated.
- Operation check with WordPress 6.8

= 1.0.2 =
- Fixed the issue where the icon inverted display was not displayed properly when selecting a block.

= 1.0.1 =
Fixed a bug in Post Pickup where the selection button was not displayed when the featured image was not set for the first post.

= 1.0.0 =
* Release

== Upgrade Notice ==
= 2.4.1 =
Fixes missing padding and margin on Post Content inside Post Pickup, and shows translated term names in Post Filter on translated pages. No configuration changes are required.

= 2.4.0 =
Post Pickup field videos now use muted autoplay and looping without playback controls. Videos keep their native proportions; choose a ratio under the field Video block's Styles panel to crop a landscape file into a portrait preview. Browser autoplay policies and external video-provider restrictions still apply.

= 2.3.1 =
Fixes taxonomy selection, custom-field image and button URLs, and Post Content styles. Check Post Pickup blocks that use custom fields or have changed post types.

= 2.3.0 =
Rebuilt with the latest shared packages. No configuration changes are required.

= 2.1.2 =
Fixes the sample image showing instead of the gallery images in the slider. No configuration changes are required.

= 2.1.1 =
Adds an explanatory notice when a filtered taxonomy has no terms. No configuration changes are required.

= 2.1.0 =
Rebuilt with the latest shared packages; colors follow the active theme. No configuration changes are required.

== Arbitrary section ==
1. PHP class management is now done using Composer.  
[GitHub](https://github.com/itmaroon/block-class-package)  
[Packagist](https://packagist.org/packages/itmar/block-class-package)
 
2. I decided to make functions and components common to other plugins into npm packages, and install and use them from npm.  
[npm](https://www.npmjs.com/package/itmar-block-packages)  
[GitHub](https://github.com/itmaroon/itmar-block-packages)

== External services ==  
This plugin connects to the API to get holiday information. This is necessary to display the names of holidays in the displayed calendar.
This service is provided by "Google LLC". The terms of use and privacy policy are available at the following links:
[Google API Services User Data Policy](https://developers.google.com/terms/api-services-user-data-policy?hl=ja)
[Google Calendar Partner Program Terms of Use](https://www.google.co.jp/googlecalendar/partner_program_policies.html)
[Google Privacy Policy](https://policies.google.com/privacy?hl=ja)
[Google Calendar Privacy Basics](https://support.google.com/calendar/answer/10366125?hl=ja)
