{"id":24888651,"url":"https://github.com/juvojustin/bricks-custom-query","last_synced_at":"2026-03-04T00:42:22.683Z","repository":{"id":223480628,"uuid":"760445081","full_name":"JUVOJustin/bricks-custom-query","owner":"JUVOJustin","description":"Dev friendly way of adding custom queries to the bricks builder. Add your own logic and functionality to loops.","archived":false,"fork":false,"pushed_at":"2024-11-30T08:13:39.000Z","size":35,"stargazers_count":10,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T09:33:28.282Z","etag":null,"topics":["bricksbuilder","query","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JUVOJustin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-20T12:41:19.000Z","updated_at":"2025-07-12T12:43:39.000Z","dependencies_parsed_at":"2024-04-10T20:23:52.353Z","dependency_job_id":"31eadaf5-b45c-4949-84ac-eaa9f5204835","html_url":"https://github.com/JUVOJustin/bricks-custom-query","commit_stats":null,"previous_names":["juvojustin/bricks-custom-query"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/JUVOJustin/bricks-custom-query","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JUVOJustin%2Fbricks-custom-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JUVOJustin%2Fbricks-custom-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JUVOJustin%2Fbricks-custom-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JUVOJustin%2Fbricks-custom-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JUVOJustin","download_url":"https://codeload.github.com/JUVOJustin/bricks-custom-query/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JUVOJustin%2Fbricks-custom-query/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279159536,"owners_count":26116492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bricksbuilder","query","wordpress"],"created_at":"2025-02-01T16:14:23.850Z","updated_at":"2025-10-16T05:32:20.689Z","avatar_url":"https://github.com/JUVOJustin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# God damn easy Bricks Builder Custom Queries\n\nYou are a developer and want to add custom queries to the bricks builder? This package is for you. From now on you\ncan add your own logic and functionality to loops. Ever wanted to iterate your custom database, external APIs or WordPress Data Structures in a highly complex loop? Here you go.\n\nFeature overview:\n\n- Simple registration of Custom Queries\n- Automatic Performance Profiling for the [Query Monitor Plugin](https://de.wordpress.org/plugins/query-monitor/)\n- Add custom controls to your query\n- WP Gridbuilder Support (Only for native WordPress Data Types)\n- [Multisite Queries](https://github.com/JUVOJustin/bricks-custom-query/wiki/Query-Configs#multisite-control]) (Only for native WordPress Data Types)\n\n## Installation\n\nTo install the package you can use composer. Run the following command in your terminal:\n\n```bash\ncomposer require juvo/bricks-custom-query\n```\n\nYou should initiate the registry as early as possible. The best place to do this is in your plugin's main file or the\nfunctions.php of your theme.\n\n```php\nadd_action('init', function() {\n    juvo\\Bricks_Custom_Queries\\Query_Registry::getInstance();\n});\n```\n\n## Usage\n\nTo register a simple query you can use the following code snippet. The first parameter is the query name, the second\nparameter is the query label, the third parameter is the callback that returns a callback.\n\n```php\nQuery_Registry::set(\n    'collection_prompts', // Query name\n    'Collection Prompts', // Query label\n    function(array $args, \\Bricks\\Query $query_obj, juvo\\Bricks_Custom_Queries\\Query $query) { // Callback for query args\n        return array_merge($args, [\n                'post_type' =\u003e 'posts',\n            ]\n        );\n    }\n);\n```\n\n### Query Types\n\nThere is an optional fourth parameter that allows you to set the type of the query. If you query something other than a\npost please change the type accordingly. Supported types are set up as a PHP Enum. The default type\nis `Query_Type::Post`.\n\n```php\nenum Query_Type\n{\n    case Post;\n    case User;\n    case Term;\n    case Other;\n}\n```\n\nChoose `Query_Type::Other` if you are not working with native wordpress data types. A more in detail guide for \"Other\" queries can be found in [this guide](https://github.com/JUVOJustin/bricks-custom-query/wiki/Queries-of-type-%22Other%22)\n\n### Query Callback\n\nFor native wordpress data types the callback must return valid query arguments. For custom data types you need to return\nthe actual data. For the later the return value will not be processed further.\n\n### Query Configuration\nYou can configure a couple of query configurations using setter function. Full documentation for these can be found here:\nhttps://github.com/JUVOJustin/bricks-custom-query/wiki/Query-Configs\n\n\n### Additional Controls\nYou can add additional controls to your query. The full list of controls can be found here: https://academy.bricksbuilder.io/topic/controls/\nYou don´t need to set the tab.\n\n```php\nQuery_Registry::set(\n    'collection_prompts', // Query name\n    'Collection Prompts', // Query label\n    function(array $args, \\Bricks\\Query $query_obj, juvo\\Bricks_Custom_Queries\\Query $query) { // Callback for query args\n        \n        // Check setting and apply your logic\n        if (!empty($query_obj-\u003esettings['return_all'])) {\n            $args['posts_per_page'] = -1;\n        }\n        \n        return array_merge($args, [\n                'post_type' =\u003e 'posts',\n            ]\n        );\n    }\n)-\u003eset_controls([\n    'return_all' =\u003e [\n        'label' =\u003e esc_html('Return all'),\n        'type'  =\u003e 'checkbox',\n    ]\n]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuvojustin%2Fbricks-custom-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuvojustin%2Fbricks-custom-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuvojustin%2Fbricks-custom-query/lists"}