/
templates.php
46 lines (44 loc) · 946 Bytes
/
templates.php
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
43
44
45
46
<?php
/**
* Plugin Name: Gutenberg Test Plugin, Templates
* Plugin URI: https://github.com/WordPress/gutenberg
* Author: Gutenberg Team
*
* @package gutenberg-test-templates
*/
/**
* Registers a book CPT with a template
*/
function gutenberg_test_templates_register_book_type() {
$args = array(
'public' => true,
'label' => 'Books',
'show_in_rest' => true,
'template' => array(
array( 'core/image' ),
array(
'core/paragraph',
array(
'placeholder' => 'Add a book description',
),
),
array( 'core/quote' ),
array(
'core/columns',
array(),
array(
array( 'core/image', array( 'layout' => 'column-1' ) ),
array(
'core/paragraph',
array(
'placeholder' => 'Add a inner paragraph',
'layout' => 'column-2',
),
),
),
),
),
);
register_post_type( 'book', $args );
}
add_action( 'init', 'gutenberg_test_templates_register_book_type' );