1
+ <?php
2
+
3
+ class Least {
4
+
5
+ /** @var self Instance */
6
+ private static $ _instance ;
7
+
8
+ private function __construct () {
9
+ add_filter ( 'default_wp_template_part_areas ' , array ( $ this , 'template_part_areas ' ) );
10
+ add_action ( 'after_setup_theme ' , array ( $ this , 'support ' ) );
11
+ add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'scripts ' ) );
12
+ }
13
+
14
+ /**
15
+ * Returns instance of current calss
16
+ * @return self Instance
17
+ */
18
+ public static function instance () {
19
+ if ( ! self ::$ _instance ) {
20
+ self ::$ _instance = new self ();
21
+ }
22
+
23
+ return self ::$ _instance ;
24
+ }
25
+
26
+ public function support ( $ areas ) {
27
+ // Adding support for core block visual styles.
28
+ add_theme_support ( 'wp-block-styles ' );
29
+
30
+ // Enqueue editor styles.
31
+ add_editor_style ( 'style.css ' );
32
+ }
33
+
34
+ public function scripts ( $ areas ) {
35
+ // Enqueue theme stylesheet.
36
+ wp_enqueue_style ( 'least-style ' , get_template_directory_uri () . '/style.css ' , array (), wp_get_theme ()->get ( 'Version ' ) );
37
+ }
38
+
39
+ public function template_part_areas ( $ areas ) {
40
+ $ areas [] = array (
41
+ 'area ' => 'blog-content ' ,
42
+ 'label ' => __ ( 'Blog post content ' , 'gutenberg ' ),
43
+ 'description ' => __ (
44
+ 'Templates in blog content area shows on page with multiple posts. '
45
+ ),
46
+ 'icon ' => 'footer ' ,
47
+ 'area_tag ' => 'footer ' ,
48
+ );
49
+
50
+ return $ areas ;
51
+ }
52
+ }
0 commit comments