Przeglądaj źródła

Added materials to Events and Exhibition

tags/1.0.0^2^2
Alej 3 lat temu
rodzic
commit
a49614edd4

+ 1
- 1
plugins/cia-post-types/includes/custom-taxonomies.php Wyświetl plik

@@ -1,7 +1,7 @@
1 1
 <?php
2 2
     function create_materials_taxonomy() {
3 3
         $post_types_that_show_materials = [
4
-            'artist', 'guide', 'short',
4
+            'artist', 'exhibition', 'event', 'guide', 'short',
5 5
             'object', 'publication', 'technique'
6 6
         ];
7 7
         register_taxonomy('material', $post_types_that_show_materials, ['label' => 'Materials']);

+ 29
- 3
vue-theme/functions.php Wyświetl plik

@@ -220,8 +220,8 @@ add_filter( 'manage_artist_posts_columns', 'set_custom_edit_artist_columns' );
220 220
 function set_custom_edit_artist_columns($columns) {
221 221
     $date = $columns['date'];
222 222
     unset( $columns['date'] );
223
-    $columns['artist_type'] = __('Artist Type', 'my-text-domain' );
224
-    $columns['material'] = __('Material', 'my-text-xx' );
223
+    $columns['artist_type'] = __('Artist Type' );
224
+    $columns['material'] = __('Material' );
225 225
     $columns['date'] = $date;
226 226
     return $columns;
227 227
 }
@@ -247,7 +247,8 @@ add_filter( 'manage_event_posts_columns', 'set_custom_edit_event_columns' );
247 247
 function set_custom_edit_event_columns($columns) {
248 248
     $date = $columns['date'];
249 249
     unset( $columns['date'] );
250
-    $columns['event_type'] = __('Event Type');
250
+    $columns['event_type'] = __('Event Type' );
251
+    $columns['material'] = __('Material' );
251 252
     $columns['date'] = $date;
252 253
     return $columns;
253 254
 }
@@ -259,6 +260,31 @@ function custom_event_column( $column, $post_id ) {
259 260
             $terms = get_the_term_list( $post_id , 'event_type' , '' , ', ' , '' );
260 261
             echo is_string( $terms ) ? $terms : '—';
261 262
             break;
263
+            // display a list of material terms assigned to the post 
264
+        case 'material' :
265
+            $terms = get_the_term_list( $post_id , 'material' , '' , ', ' , '' );
266
+            echo is_string( $terms ) ? $terms : '—';
267
+            break;
268
+    }
269
+}
270
+
271
+// Add the custom columns for EXHIBITION:
272
+add_filter( 'manage_exhibition_posts_columns', 'set_custom_edit_exhibition_columns' );
273
+function set_custom_edit_exhibition_columns($columns) {
274
+    $date = $columns['date'];
275
+    unset( $columns['date'] );
276
+    $columns['material'] = __('Material');
277
+    $columns['date'] = $date;
278
+    return $columns;
279
+}
280
+// Add the data to the custom columns for EXHIBITION:
281
+add_action( 'manage_exhibition_posts_custom_column' , 'custom_exhibition_column', 10, 2 );
282
+function custom_exhibition_column( $column, $post_id ) {
283
+    switch ( $column ) {
284
+        case 'material' :
285
+            $terms = get_the_term_list( $post_id , 'material' , '' , ', ' , '' );
286
+            echo is_string( $terms ) ? $terms : '—';
287
+            break;
262 288
     }
263 289
 }
264 290
 

+ 1
- 1
vue-theme/src/utils/helpers.js Wyświetl plik

@@ -7,7 +7,7 @@ const materials = ['clay', 'fiber', 'glass', 'metal', 'paper', 'wood']
7 7
 
8 8
 const sortTypes = {
9 9
     alpha: 'by-alpha',
10
-u    material: 'by-material',
10
+    material: 'by-material',
11 11
     artist: 'by-artist',
12 12
     episode: 'by-episode',
13 13
     upcoming: 'by-upcoming',

Ładowanie…
Anuluj
Zapisz