Explorar el Código

:sparkles: integrating credits

tags/0.9.0
TOJ hace 5 años
padre
commit
a35a014d62

+ 8
- 6
plugins/cia-endpoints/includes/class.make-endpoint.php Ver fichero

@@ -113,27 +113,29 @@ class Make_Endpoint_For extends WP_REST_Controller {
113 113
             // For your hero URL
114 114
             $filtered[hero] = get_post_meta( $item->ID, 'hero_header', true );
115 115
 
116
+            $filtered[credits] = get_post_meta( $item->ID, 'credits', true );
117
+
116 118
             $filtered[relatedto] = p2p_related_to( $item->ID, $item->post_type );
117
-            
119
+
118 120
             $collection[$item->ID] = $filtered;
119 121
         }
120 122
         wp_reset_postdata();
121
-        
123
+
122 124
         return $collection;
123 125
     }
124 126
     public function prepare_all_items_for_response( $args ) {
125 127
         $collection = array();
126
-        
128
+
127 129
         // https://developer.wordpress.org/reference/functions/get_posts/
128 130
         foreach( get_posts($args) as $item ) {
129 131
             $filtered = default_post_format( $item );
130
-            
132
+
131 133
             // Find all image info
132 134
             $filtered[attached] = $this->_getAttachments( $item, $filtered[galleries] );
133
-            
135
+
134 136
             // For your hero URL
135 137
             $filtered[hero] = get_post_meta( $item->ID, 'hero_header', true );
136
-            
138
+
137 139
             // Sticky
138 140
             $filtered[sticky] = get_post_meta( $item->ID, 'is_sticky', true );
139 141
 

+ 4
- 2
plugins/cia-endpoints/includes/formats.php Ver fichero

@@ -27,10 +27,12 @@ function default_post_format( $item ) {
27 27
         $filtered[materials] = make_taxonomy_endpoint_for( get_the_terms( $item, 'material' ) );
28 28
         $filtered[type] = make_taxonomy_endpoint_for( get_the_terms( $item, $item->post_type . '_type' ) );
29 29
     }
30
-    
30
+
31 31
     // Custom fields endpoint
32 32
     if($item->post_type === 'artist') $filtered[sortname] = get_post_meta( $item->ID, 'artist-sort-name', true );
33
-    
33
+
34
+    if($item->post_type === 'episode') $filtered[credits] = get_post_meta( $item->ID, 'credits', true );
35
+
34 36
     if($item->post_type === 'event') {
35 37
         $filtered[start] = get_post_meta( $item->ID, 'event-start-time', true );
36 38
         $filtered[end] = get_post_meta( $item->ID, 'event-end-time', true );

+ 3
- 2
plugins/cia-post-types/cia-post-types.php Ver fichero

@@ -76,8 +76,8 @@ endforeach;
76 76
 /**
77 77
  * Create taxonomies
78 78
  */
79
-add_action('init', 'create_materials_taxonomy'); 
80
-add_action('init', 'create_types_taxonomy'); 
79
+add_action('init', 'create_materials_taxonomy');
80
+add_action('init', 'create_types_taxonomy');
81 81
 
82 82
 /**
83 83
  * Create CMB Metaboxes
@@ -85,6 +85,7 @@ add_action('init', 'create_types_taxonomy');
85 85
 add_action( 'cmb2_admin_init', 'cmb2_hero_metaboxes' );
86 86
 add_action( 'cmb2_admin_init', 'cmb2_sticky_metaboxes' );
87 87
 add_action( 'cmb2_admin_init', 'cmb2_artist_sort_metaboxes' );
88
+add_action( 'cmb2_admin_init', 'cmb2_episode_credits_metaboxes' );
88 89
 add_action( 'cmb2_admin_init', 'cmb2_event_date_metaboxes' );
89 90
 add_action( 'cmb2_admin_init', 'cmb2_exhibition_date_metaboxes' );
90 91
 

+ 69
- 54
plugins/cia-post-types/includes/custom-metaboxes.php Ver fichero

@@ -4,7 +4,7 @@
4 4
      * Defining our HERO, and Name override fields
5 5
      */
6 6
     function sanitize_hero_urls( $value, $field_args, $field ) {
7
-        $encoded = wp_json_encode( array( 'url' => $value ), true );
7
+        $encoded = wp_json_encode( ['url' => $value], true );
8 8
         return $encoded;
9 9
     }
10 10
 
@@ -20,7 +20,7 @@
20 20
         <div class="custom-field-row">
21 21
             <p>
22 22
                 <label for="<?php echo $id; ?>"><?php echo $label; ?></label>
23
-                <input style="width: 100%;" id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>" 
23
+                <input style="width: 100%;" id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>"
24 24
                     value="<?php echo $decoded['url']; ?>"/>
25 25
             </p>
26 26
             <p class="description"><?php echo $description; ?></p>
@@ -36,22 +36,22 @@
36 36
         /**
37 37
          * Initiate the metabox
38 38
          */
39
-        $cmb = new_cmb2_box( array(
40
-            'id'            => 'hero_metabox',
41
-            'title'         => __( 'Hero', 'cmb2' ),
42
-            'object_types'  => array( 'artist', 'event', 'exhibition' ), // Post type
43
-            'show_in_rest'  => WP_REST_Server::READABLE
44
-        ) );
39
+        $cmb = new_cmb2_box([
40
+            'id'              => 'hero_metabox',
41
+            'title'           => __( 'Hero', 'cmb2' ),
42
+            'object_types'    => ['artist', 'episode', 'event', 'exhibition'], // Post type
43
+            'show_in_rest'    => WP_REST_Server::READABLE
44
+        ]);
45 45
 
46 46
         // URL text field
47
-        $cmb->add_field( array(
48
-            'name'             => __( 'YouTube URL', 'cmb2' ),
49
-            'desc'             => __( 'Video for the hero section to display', 'cmb2' ),
50
-            'id'               => 'hero_header',
51
-            'type'             => 'text',
52
-            'sanitization_cb'  => 'sanitize_hero_urls',
53
-            'render_row_cb' => 'cmb_hero_render_row_cb'
54
-        ) );
47
+        $cmb->add_field([
48
+            'name'            => __( 'YouTube URL', 'cmb2' ),
49
+            'desc'            => __( 'Video for the hero section to display', 'cmb2' ),
50
+            'id'              => 'hero_header',
51
+            'type'            => 'text',
52
+            'sanitization_cb' => 'sanitize_hero_urls',
53
+            'render_row_cb'   => 'cmb_hero_render_row_cb'
54
+        ]);
55 55
     }
56 56
 
57 57
     function cmb2_sticky_metaboxes() {
@@ -59,76 +59,91 @@
59 59
         /**
60 60
          * Initiate the metabox
61 61
          */
62
-        $cmb = new_cmb2_box( array(
63
-            'id'            => 'stick_metabox',
64
-            'title'         => __( 'Sticky Post', 'cmb2' ),
65
-            'object_types'  => array( 'artist', 'event', 'exhibition', 'episode', 'page', 'post' ), // Post type
66
-            'show_in_rest'  => WP_REST_Server::READABLE
67
-        ) );
62
+        $cmb = new_cmb2_box([
63
+            'id'           => 'stick_metabox',
64
+            'title'        => __( 'Sticky Post', 'cmb2' ),
65
+            'object_types' => ['artist', 'event', 'exhibition', 'episode', 'page', 'post'], // Post type
66
+            'show_in_rest' => WP_REST_Server::READABLE
67
+        ]);
68 68
 
69 69
         // URL text field
70
-        $cmb->add_field( array(
71
-            'name'             => __( 'Make sticky?', 'cmb2' ),
72
-            'desc'             => __( 'Check to stick this post on the homepage', 'cmb2' ),
73
-            'id'               => 'is_sticky',
74
-            'type'             => 'checkbox'
75
-        ) );
70
+        $cmb->add_field([
71
+            'name'         => __( 'Make sticky?', 'cmb2' ),
72
+            'desc'         => __( 'Check to stick this post on the homepage', 'cmb2' ),
73
+            'id'           => 'is_sticky',
74
+            'type'         => 'checkbox'
75
+        ]);
76 76
     }
77 77
 
78 78
     function cmb2_artist_sort_metaboxes() {
79
-        $cmb = new_cmb2_box( array(
80
-            'id'            => 'artist_sort_metabox',
81
-            'title'         => __( 'Name Override', 'cmb2' ),
82
-            'object_types'  => array( 'artist' ),
83
-            'show_in_rest'  => WP_REST_Server::READABLE
84
-        ) );
85
-        $cmb->add_field( array(
86
-            'name'             => __( 'Alternate Name', 'cmb2' ),
87
-            'desc'             => __( 'Name to use for alphabetical sorting', 'cmb2' ),
88
-            'id'               => 'artist-sort-name',
89
-            'type'             => 'text'
90
-        ) );
79
+        $cmb = new_cmb2_box([
80
+            'id'           => 'artist_sort_metabox',
81
+            'title'        => __( 'Name Override', 'cmb2' ),
82
+            'object_types' => ['artist'],
83
+            'show_in_rest' => WP_REST_Server::READABLE
84
+        ]);
85
+        $cmb->add_field([
86
+            'name'         => __( 'Alternate Name', 'cmb2' ),
87
+            'desc'         => __( 'Name to use for alphabetical sorting', 'cmb2' ),
88
+            'id'           => 'artist-sort-name',
89
+            'type'         => 'text'
90
+        ]);
91
+    }
92
+
93
+    function cmb2_episode_credits_metaboxes() {
94
+        $cmb = new_cmb2_box([
95
+            'id'           => 'meta_credits',
96
+            'title'        => __( 'Credits', 'cmb2' ),
97
+            'object_types' => ['episode'],
98
+            'show_in_rest' => WP_REST_Server::READABLE
99
+        ]);
100
+        $cmb->add_field([
101
+            'name'         => __( 'Episode Credits', 'cmb2' ),
102
+            'desc'         => __( 'HTML content for Episode credits', 'cmb2' ),
103
+            'id'           => 'credits',
104
+            'type'         => 'wysiwyg'
105
+        ]);
91 106
     }
92 107
 
93 108
     function cmb2_event_date_metaboxes() {
94
-        $cmb = new_cmb2_box( array(
109
+        $cmb = new_cmb2_box([
95 110
             'id'            => 'event-date',
96 111
             'title'         => __( 'Date and Time', 'cmb2' ),
97
-            'object_types'  => array( 'event' ), // Post type
112
+            'object_types'  => ['event'], // Post type
98 113
             'show_in_rest'  => WP_REST_Server::READABLE
99
-        ) );
100
-        $cmb->add_field( array(
114
+        ]);
115
+        $cmb->add_field([
101 116
             'name'             => __( 'Start', 'cmb2' ),
102 117
             'desc'             => __( 'The date and time of your event', 'cmb2' ),
103 118
             'id'               => 'event-start-time',
104 119
             'type'             => 'text_datetime_timestamp'
105
-        ) );
106
-        $cmb->add_field( array(
120
+        ]);
121
+        $cmb->add_field([
107 122
             'name'             => __( 'End', 'cmb2' ),
108 123
             'desc'             => __( 'The date and time your event ends', 'cmb2' ),
109 124
             'id'               => 'event-end-time',
110 125
             'type'             => 'text_datetime_timestamp'
111
-        ) );
126
+        ]);
112 127
     }
113 128
 
114 129
     function cmb2_exhibition_date_metaboxes() {
115
-        $cmb = new_cmb2_box( array(
130
+        $cmb = new_cmb2_box([
116 131
             'id'            => 'exhibit-date',
117 132
             'title'         => __( 'Date', 'cmb2' ),
118
-            'object_types'  => array( 'exhibition' ), // Post type
133
+            'object_types'  => ['exhibition'], // Post type
119 134
             'show_in_rest'  => WP_REST_Server::READABLE
120
-        ) );
121
-        $cmb->add_field( array(
135
+        ]);
136
+        $cmb->add_field([
122 137
             'name'             => __( 'Start Date', 'cmb2' ),
123 138
             'desc'             => __( 'The date of your exhibition', 'cmb2' ),
124 139
             'id'               => 'exhibit-start-date',
125 140
             'type'             => 'text_date_timestamp'
126
-        ) );
127
-        $cmb->add_field( array(
141
+        ]);
142
+        $cmb->add_field([
128 143
             'name'             => __( 'End Date', 'cmb2' ),
129 144
             'desc'             => __( 'The date your exhibition ends', 'cmb2' ),
130 145
             'id'               => 'exhibit-end-date',
131 146
             'type'             => 'text_date_timestamp'
132
-        ) );
147
+        ]);
133 148
     }
134 149
 ?>

+ 2
- 2
plugins/cia-post-types/includes/custom-taxonomies.php Ver fichero

@@ -1,12 +1,12 @@
1 1
 <?php
2 2
     function create_materials_taxonomy() {
3 3
         $post_types_that_show_materials = [ 'artist', 'exhibition', 'event' ];
4
-        register_taxonomy('material', $post_types_that_show_materials, [ "label" => "Materials"]);
4
+        register_taxonomy('material', $post_types_that_show_materials, ['label' => 'Materials']);
5 5
     }
6 6
     function create_types_taxonomy() {
7 7
         $post_types = [ 'artist', 'exhibition', 'event' ];
8 8
         foreach ( $post_types as $post_type ):
9
-            register_taxonomy($post_type . '_type', $post_type, [ "label" => ucfirst($post_type) . " Type"]);
9
+            register_taxonomy($post_type . '_type', $post_type, ['label' => ucfirst($post_type) . ' Type']);
10 10
         endforeach;
11 11
     }
12 12
 ?>

+ 1
- 1
vue-theme/src/app.vue Ver fichero

@@ -30,7 +30,7 @@ html > body
30 30
         width: 100%
31 31
         
32 32
         :--headings
33
-            color: red
33
+            color: yellow
34 34
 
35 35
         > [class^="page--"]
36 36
             background-color: pink

Loading…
Cancelar
Guardar