blob: 7c99778bb95aba77d627f0fdf48283007489260d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# Metabox
This is basically an abstraction layer around [Advanced Custom Fields](https://github.com/AdvancedCustomFields/acf).
It's meant to complement [PostTypes](https://github.com/jjgrainger/PostTypes)!
## Requirements
- PHP >= 7.4
- [Composer](https://getcomposer.org/)
- most recent version of [WordPress](https://wordpress.org)
- [Advanced Custom Fields WordPress Plugin](https://wordpress.org/plugins/advanced-custom-fields/) installed and active
## Installation
```
composer require drogueronin/metaboxes
```
## How to
```php
use PostTypes\Metabox;
use PostTypes\MetaboxField;
// create a metabox
$metabox = new Metabox('Meta');
// assign a post type to it
$metabox->posttype('post');
// create a field for the box
$field = new MetaboxField('image');
// set the fields ACF type
$field->type('image');
// add the field to the metabox
$metabox->field($field);
// add the box and its fields with ACF
$metabox->add();
```
|