humanmade / humanmade/Custom-Meta-Boxes
Cannot use both id and page-template in show_on array
- Lingua principale
- PHP
- Stelle
- 516
- Fork
- 118
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I have some meta boxes that need to only appear on the homepage and when a certain page template is selected.
I tried using the following setup:
```
$meta_boxes[] = array(
'title' => 'Feature Settings',
'pages' => array( 'page' ),
'show_on' => array(
'id' => array( get_option( 'page_on_front' ) ),
'page-template' => array(
'page-templates/feature.php',
),
),
'context' => 'normal',
'priority' => 'core',
'fields' => $this->fields(),
);
```
But the boxes do not appear on the front page. Any value passed to `id` is ignored while `page-template` exists in the same `show_on` array.
I've got around this by having two `$meta_boxes[]` arrays, one with using `id` and the other using `page_template`, which works fine.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia dalla gestione della configurazione show_on per le condizioni combinate id e page-template, quindi riproduci il caso della homepage con un template corrispondente. Traccia il motivo per cui la condizione id viene ignorata, aggiungi la copertura per entrambe le condizioni insieme e conferma che i meta box compaiano in ogni contesto corrispondente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php, wordpress
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100