PHPackages                             juvo/bricks-custom-query - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. juvo/bricks-custom-query

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

juvo/bricks-custom-query
========================

Easy to use custom bricks query

1.0.6(1y ago)122.0k↑11.1%[1 issues](https://github.com/JUVOJustin/bricks-custom-query/issues)[2 PRs](https://github.com/JUVOJustin/bricks-custom-query/pulls)GPL-3.0-or-laterPHPPHP &gt;=8.1.0

Since Feb 20Pushed 1y ago2 watchersCompare

[ Source](https://github.com/JUVOJustin/bricks-custom-query)[ Packagist](https://packagist.org/packages/juvo/bricks-custom-query)[ RSS](/packages/juvo-bricks-custom-query/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (11)Used By (0)

God damn easy Bricks Builder Custom Queries
===========================================

[](#god-damn-easy-bricks-builder-custom-queries)

You are a developer and want to add custom queries to the bricks builder? This package is for you. From now on you can 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.

Feature overview:

- Simple registration of Custom Queries
- Automatic Performance Profiling for the [Query Monitor Plugin](https://de.wordpress.org/plugins/query-monitor/)
- Add custom controls to your query
- WP Gridbuilder Support (Only for native WordPress Data Types)
- [Multisite Queries](https://github.com/JUVOJustin/bricks-custom-query/wiki/Query-Configs#multisite-control%5D) (Only for native WordPress Data Types)

Installation
------------

[](#installation)

To install the package you can use composer. Run the following command in your terminal:

```
composer require juvo/bricks-custom-query
```

You should initiate the registry as early as possible. The best place to do this is in your plugin's main file or the functions.php of your theme.

```
add_action('init', function() {
    juvo\Bricks_Custom_Queries\Query_Registry::getInstance();
});
```

Usage
-----

[](#usage)

To register a simple query you can use the following code snippet. The first parameter is the query name, the second parameter is the query label, the third parameter is the callback that returns a callback.

```
Query_Registry::set(
    'collection_prompts', // Query name
    'Collection Prompts', // Query label
    function(array $args, \Bricks\Query $query_obj, juvo\Bricks_Custom_Queries\Query $query) { // Callback for query args
        return array_merge($args, [
                'post_type' => 'posts',
            ]
        );
    }
);
```

### Query Types

[](#query-types)

There is an optional fourth parameter that allows you to set the type of the query. If you query something other than a post please change the type accordingly. Supported types are set up as a PHP Enum. The default type is `Query_Type::Post`.

```
enum Query_Type
{
    case Post;
    case User;
    case Term;
    case Other;
}
```

Choose `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)

### Query Callback

[](#query-callback)

For native wordpress data types the callback must return valid query arguments. For custom data types you need to return the actual data. For the later the return value will not be processed further.

### Query Configuration

[](#query-configuration)

You can configure a couple of query configurations using setter function. Full documentation for these can be found here:

### Additional Controls

[](#additional-controls)

You can add additional controls to your query. The full list of controls can be found here: You don´t need to set the tab.

```
Query_Registry::set(
    'collection_prompts', // Query name
    'Collection Prompts', // Query label
    function(array $args, \Bricks\Query $query_obj, juvo\Bricks_Custom_Queries\Query $query) { // Callback for query args

        // Check setting and apply your logic
        if (!empty($query_obj->settings['return_all'])) {
            $args['posts_per_page'] = -1;
        }

        return array_merge($args, [
                'post_type' => 'posts',
            ]
        );
    }
)->set_controls([
    'return_all' => [
        'label' => esc_html('Return all'),
        'type'  => 'checkbox',
    ]
]);
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~54 days

Total

7

Last Release

598d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32efecde6068b3efb5bd8edbfc59500f23c7047b43f7846790925f73e23317a6?d=identicon)[JUVOJustin](/maintainers/JUVOJustin)

---

Top Contributors

[![lauratheq](https://avatars.githubusercontent.com/u/112548939?v=4)](https://github.com/lauratheq "lauratheq (5 commits)")[![laura-usc](https://avatars.githubusercontent.com/u/112548939?v=4)](https://github.com/laura-usc "laura-usc (1 commits)")

---

Tags

bricksbuilderquerywordpresswordpressquerybricksbuilder

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/juvo-bricks-custom-query/health.svg)

```
[![Health](https://phpackages.com/badges/juvo-bricks-custom-query/health.svg)](https://phpackages.com/packages/juvo-bricks-custom-query)
```

###  Alternatives

[tgmpa/tgm-plugin-activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins).

1.8k222.5k13](/packages/tgmpa-tgm-plugin-activation)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[juvo/bricks-dynamic-data-tags

Easy to use dynamic data tags for Bricks

152.3k](/packages/juvo-bricks-dynamic-data-tags)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
