alleyinteractive / alleyinteractive/wp-match-blocks

Make it possible to query by attributes via key-value pairs

Offen
#21 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
9
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Description

Before:

```
$blocks = \Alley\WP\match_blocks(
$post,
[
'attrs' => [
[
'key' => 'align',
'value' => 'right',
],
],
'name' => 'core/paragraph',
]
);
```

After:

```
$blocks = \Alley\WP\match_blocks(
$post,
[
'attrs' => [
'align' => 'right',
],
'name' => 'core/paragraph',
],
);
```

### Use Case

The reason that this syntax isn't supported is so that the `attrs` parameter behaves like `meta_query`, `tax_query`, etc. I still like that consistency, but I also still get annoyed at having to write the whole thing out, so maybe the consistency isn't worth it.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.