-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinding-meta.php
48 lines (37 loc) · 1.15 KB
/
binding-meta.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
47
48
<?php
namespace WP_Performance\Inc;
function get_hero_category($args)
{
global $post;
$post_type = $post->post_type;
switch ($post_type) {
case 'post':
return __('Articles, archives et categories', 'press-wind');
break;
case 'snippet':
return __('Snippets, archives et categories', 'press-wind');
break;
default:
return __('Archives et categories', 'press-wind');
break;
}
}
function register_block_bindings()
{
register_meta(
'post',
'wp_performance-page-thematic',
array(
'show_in_rest' => true,
'single' => true,
'type' => 'string',
'sanitize_callback' => 'wp_strip_all_tags',
'default' => 'Totalement open-source',
)
);
register_block_bindings_source('wpperformance/hero-category', array(
'label' => __('Hero theme category', 'press-wind'),
'get_value_callback' => __NAMESPACE__ . '\get_hero_category',
));
}
add_action('init', __NAMESPACE__ . '\register_block_bindings');