blob: fd659477497f2a9f062b5bcf2e37eda76915ea03 (
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 dweipert/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();
```
|