Browse Source

:recycle: removing the_content for related posts | using smaller images for cards | storing thumbnail link for featured image for use with card

tags/0.9.0
j 4 years ago
parent
commit
85a7526dfc

+ 6
- 2
plugins/cia-endpoints/includes/formats.php View File

26
         $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true );
26
         $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true );
27
         $filtered[featured] = get_post($thumbnailId)->guid;
27
         $filtered[featured] = get_post($thumbnailId)->guid;
28
     }
28
     }
29
-
29
+    $filtered[thumb] = get_the_post_thumbnail_url($item, 'medium');
30
+    if(!$filtered[thumb]) {
31
+        $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true );
32
+        $filtered[thumb] = get_post($thumbnailId)->guid;
33
+    }
30
     // Materials + type endpoints
34
     // Materials + type endpoints
31
     // if($item->post_type === 'artist' || $item->post_type === 'event' || $item->post_type === 'exhibition') {
35
     // if($item->post_type === 'artist' || $item->post_type === 'event' || $item->post_type === 'exhibition') {
32
     $posts_with_type = ['artist', 'exhbition', 'event'];
36
     $posts_with_type = ['artist', 'exhbition', 'event'];
36
     }
40
     }
37
 
41
 
38
     // Custom fields endpoint
42
     // Custom fields endpoint
39
-    if($item->post_type === 'episode') $filtered[credits] = get_post_meta( $item->ID, 'credits', true );
43
+    if($item->post_type === 'episode' && $include_content) $filtered[credits] = get_post_meta( $item->ID, 'credits', true );
40
 
44
 
41
     if($item->post_type === 'artist') $filtered[sortname] = get_post_meta( $item->ID, 'artist-sort-name', true );
45
     if($item->post_type === 'artist') $filtered[sortname] = get_post_meta( $item->ID, 'artist-sort-name', true );
42
 
46
 

+ 1
- 1
plugins/cia-endpoints/includes/related-items.php View File

28
     );
28
     );
29
     $related_items = get_posts($args);
29
     $related_items = get_posts($args);
30
     forEach( $related_items as $item ) {
30
     forEach( $related_items as $item ) {
31
-        $collection[$item->ID] = default_post_format($item, true);
31
+        $collection[$item->ID] = default_post_format($item, false);
32
     }
32
     }
33
     return $collection;
33
     return $collection;
34
 }
34
 }

+ 4
- 9
plugins/cia-post-types/includes/custom-types.php View File

5
             'episode',
5
             'episode',
6
             'event',
6
             'event',
7
             'exhibition',
7
             'exhibition',
8
-            
9
             // 'guide',
8
             // 'guide',
10
-            
11
             // 'short',
9
             // 'short',
12
-                // 'talk',
13
-                // 'technique',
14
-            
15
-                // 'object',
16
-            
10
+            // 'talk',
11
+            // 'technique',
12
+            // 'object',
17
             // 'publication',
13
             // 'publication',
18
-                // 'profile',
19
-    
14
+            // 'profile',
20
             // 'product'
15
             // 'product'
21
         ];
16
         ];
22
     }
17
     }

+ 5
- 1
vue-theme/src/components/featured-image.vue View File

1
 <template lang="pug">
1
 <template lang="pug">
2
 .featured-or-hero-image
2
 .featured-or-hero-image
3
-    img(v-if="featured" :src="featured" alt="post thumbnail")
3
+    img(v-if="thumb" :src="thumb" alt="post thumbnail")
4
+    img(v-else-if="featured" :src="featured" alt="post featured")
4
     img(v-else-if="hero && hero.url" :src="getThumbnailFromYt(hero.url)" alt="post thumbnail from YouTube")
5
     img(v-else-if="hero && hero.url" :src="getThumbnailFromYt(hero.url)" alt="post thumbnail from YouTube")
5
     
6
     
6
     //- Errors
7
     //- Errors
19
         featured() {
20
         featured() {
20
             return this.post.featured ? this.post.featured : null
21
             return this.post.featured ? this.post.featured : null
21
         },
22
         },
23
+        thumb() {
24
+            return this.post.thumb ? this.post.thumb : null
25
+        },
22
         hero() {
26
         hero() {
23
             return this.post.hero && JSON.parse(this.post.hero) ? JSON.parse(this.post.hero) : null
27
             return this.post.hero && JSON.parse(this.post.hero) ? JSON.parse(this.post.hero) : null
24
         }
28
         }

Loading…
Cancel
Save