Преглед на файлове

Added materials to Events and Exhibition

tags/1.0.0^2^2
Alej преди 3 години
родител
ревизия
a49614edd4
променени са 3 файла, в които са добавени 31 реда и са изтрити 5 реда
  1. 1
    1
      plugins/cia-post-types/includes/custom-taxonomies.php
  2. 29
    3
      vue-theme/functions.php
  3. 1
    1
      vue-theme/src/utils/helpers.js

+ 1
- 1
plugins/cia-post-types/includes/custom-taxonomies.php Целия файл

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

+ 29
- 3
vue-theme/functions.php Целия файл

220
 function set_custom_edit_artist_columns($columns) {
220
 function set_custom_edit_artist_columns($columns) {
221
     $date = $columns['date'];
221
     $date = $columns['date'];
222
     unset( $columns['date'] );
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
     $columns['date'] = $date;
225
     $columns['date'] = $date;
226
     return $columns;
226
     return $columns;
227
 }
227
 }
247
 function set_custom_edit_event_columns($columns) {
247
 function set_custom_edit_event_columns($columns) {
248
     $date = $columns['date'];
248
     $date = $columns['date'];
249
     unset( $columns['date'] );
249
     unset( $columns['date'] );
250
-    $columns['event_type'] = __('Event Type');
250
+    $columns['event_type'] = __('Event Type' );
251
+    $columns['material'] = __('Material' );
251
     $columns['date'] = $date;
252
     $columns['date'] = $date;
252
     return $columns;
253
     return $columns;
253
 }
254
 }
259
             $terms = get_the_term_list( $post_id , 'event_type' , '' , ', ' , '' );
260
             $terms = get_the_term_list( $post_id , 'event_type' , '' , ', ' , '' );
260
             echo is_string( $terms ) ? $terms : '—';
261
             echo is_string( $terms ) ? $terms : '—';
261
             break;
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 Целия файл

7
 
7
 
8
 const sortTypes = {
8
 const sortTypes = {
9
     alpha: 'by-alpha',
9
     alpha: 'by-alpha',
10
-u    material: 'by-material',
10
+    material: 'by-material',
11
     artist: 'by-artist',
11
     artist: 'by-artist',
12
     episode: 'by-episode',
12
     episode: 'by-episode',
13
     upcoming: 'by-upcoming',
13
     upcoming: 'by-upcoming',

Loading…
Отказ
Запис