{"id":37004585,"url":"https://github.com/yardinternet/wp-query-block","last_synced_at":"2026-01-14T00:38:32.921Z","repository":{"id":327411307,"uuid":"775548958","full_name":"yardinternet/wp-query-block","owner":"yardinternet","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-05T10:32:32.000Z","size":1120,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-06T17:30:46.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yardinternet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-21T15:40:36.000Z","updated_at":"2025-12-05T10:32:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yardinternet/wp-query-block","commit_stats":null,"previous_names":["yardinternet/wp-query-block"],"tags_count":20,"template":false,"template_full_name":"roots/acorn-example-package","purl":"pkg:github/yardinternet/wp-query-block","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Fwp-query-block","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Fwp-query-block/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Fwp-query-block/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Fwp-query-block/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yardinternet","download_url":"https://codeload.github.com/yardinternet/wp-query-block/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Fwp-query-block/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T00:38:32.157Z","updated_at":"2026-01-14T00:38:32.872Z","avatar_url":"https://github.com/yardinternet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP Query Block\n\n[![Code Style](https://github.com/yardinternet/yard-query-block/actions/workflows/format-php.yml/badge.svg?no-cache)](https://github.com/yardinternet/yard-query-block/actions/workflows/format-php.yml)\n[![PHPStan](https://github.com/yardinternet/yard-query-block/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/yard-query-block/actions/workflows/phpstan.yml)\n[![Tests](https://github.com/yardinternet/yard-query-block/actions/workflows/run-tests.yml/badge.svg?no-cache)](https://github.com/yardinternet/yard-query-block/actions/workflows/run-tests.yml)\n[![Code Coverage Badge](https://github.com/yardinternet/yard-query-block/blob/badges/coverage.svg)](https://github.com/yardinternet/yard-query-block/actions/workflows/badges.yml)\n[![Lines of Code Badge](https://github.com/yardinternet/yard-query-block/blob/badges/lines-of-code.svg)](https://github.com/yardinternet/yard-query-block/actions/workflows/badges.yml)\n\nAn acorn package providing a \"Query Block\" for the Gutenberg editor.\n\n## Requirements\n\n- [Sage](https://github.com/roots/sage) \u003e= 10.0\n- [Acorn](https://github.com/roots/acorn) \u003e= 4.0\n\n## Installation\n\n1. Install this package with Composer:\n\n    ```sh\n    composer require yard/query-block\n    ```\n\n2. Run the Acorn WP-CLI command to discover this package:\n\n    ```shell\n    wp acorn package:discover\n    ```\n\n## Usage\n\nWhen this package is installed, you can insert the “Berichtenlijst” block in the Gutenberg editor. This block lists a series of posts based on different filter settings in the admin.\n\n### Templates\n\n#### Override Default Template\n\nA default template is included in the package. You can publish the template to your project with:\n\n```shell\nwp acorn vendor:publish --provider=\"Yard\\QueryBlock\\QueryBlockServiceProvider\"\n```\n\nThis will copy the view default.php from this package into your project at `/sage/resources/views/vendor/yard-query-block/templates/default.blade.php`. You can now modify the default template as desired.\n\n#### Create Aditional Templates\n\nYou can create additional templates by placing a template file in the same directory. For example:\n\n`/sage/resources/views/vendor/yard-query-block/templates/horizontal.blade.php`\n\nAdd the template name as a comment at the top of this template file like this:\n\n```php\n@php\n/**\n * Template: Horizontal\n *\n * @var Illuminate\\Support\\Collection|Yard\\Data\\PostData $postDataCollection\n * @var Yard\\QueryBlock\\Block\\BlockAttributes $attributes\n */\n@endphp\n```\n\nNow, you will be able to select the template from the editor. The name of the template is displayed using the value in your docblock.\n\n## Hooks\n\n### JavaScript filters\n\n#### `yard.query-inspector-config`\n\nCustomize which controls are displayed in the block's inspector panel.\n\n```js\nimport { addFilter } from '@wordpress/hooks';\n\naddFilter(\n    'yard.query-inspector-config',\n    'yard.query-inspector-config',\n    ( config, attributes ) =\u003e {\n        return {\n            ...config,\n            showPostTypeSelectControl: false, \n            showNumberOfPostsRangeControl: false,\n        };\n    }\n);\n```\n\n#### `yard.query-exclude-post-types`\n\nExclude specific post types from the list of available post types.\n\n```js\nimport { addFilter } from '@wordpress/hooks';\n\naddFilter(\n    'yard.query-exclude-post-types',\n    'yard.query-exclude-post-types',\n    ( excludedPostTypes ) =\u003e {\n        return [\n            ...excludedPostTypes,\n            'healthcare-provider',\n            'location',\n            'page',\n        ];\n    }\n);\n```\n\n#### `yard.query-exclude-taxonomies`\n\nExclude specific taxonomies from the list of available taxonomies.\n\n```js\nimport { addFilter } from '@wordpress/hooks';\n\naddFilter(\n    'yard.query-exclude-taxonomies',\n    'yard.query-exclude-taxonomies',\n    ( excludedTaxonomies ) =\u003e {\n        return [ 'category', 'post_tag' ]; \n    }\n);\n```\n\n#### `yard.query-min-number-of-posts` and `yard.query-max-number-of-posts`\n\nCustomize the minimum and maximum value for the posts per page range.\n\n```js\nimport { addFilter } from '@wordpress/hooks';\n\naddFilter(\n    'yard.query-max-number-of-posts',\n    'yard.query-max-number-of-posts',\n        (defaultMax, attributes) =\u003e {\n        const postTypeValues = attributes.postTypes?.map((type) =\u003e type.value) || [];\n        \n        if (postTypeValues.includes('news')) {\n            return 5;\n        }\n\n        if (postTypeValues.includes('healthcare-provider')) {\n            return 2;\n        }\n\n        return defaultMax;\n    }\n);\n```\n\n#### `yard.query-post-type-select-control-is-multi`\n\nChange the post type select control from multi to single select.\n\n```js\nimport { addFilter } from '@wordpress/hooks';\n\naddFilter(\n    'yard.query-post-type-select-control-is-multi',\n    'yard.query-post-type-select-control-is-multi',\n    () =\u003e false\n);\n```\n\n### PHP filters\n\n#### `yard_query_block_post_query`\n\nFilters the Post Query before it is executed on the database.\n\n| Parameters  | Type                                   | Description          |\n|-------------|----------------------------------------|----------------------|\n| $query      | \\Corcel\\Model\\Builder\\PostBuilder      | The query object     |\n| $attributes | \\Yard\\QueryBlock\\Block\\BlockAttributes | The block attributes |\n\n| Return | Type                              | Description      |\n|--------|-----------------------------------|------------------|\n| $query | \\Corcel\\Model\\Builder\\PostBuilder | The query object |\n\nExample:\n\n```php\nadd_filter('yard_query_block_post_query', function ($query, $attributes) {\n    if (is_user_logged_in()) {\n        return $query;\n    }\n\n    return $query-\u003ehasMeta('post_is_public', 'yes');\n}, 10, 2);\n```\n\n## About us\n\n[![banner](https://raw.githubusercontent.com/yardinternet/.github/refs/heads/main/profile/assets/small-banner-github.svg)](https://www.yard.nl/werken-bij/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyardinternet%2Fwp-query-block","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyardinternet%2Fwp-query-block","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyardinternet%2Fwp-query-block/lists"}