Bladeren bron

: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 jaren geleden
bovenliggende
commit
85a7526dfc

+ 6
- 2
plugins/cia-endpoints/includes/formats.php Bestand weergeven

@@ -26,7 +26,11 @@ function default_post_format( $item, $include_content ) {
26 26
         $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true );
27 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 34
     // Materials + type endpoints
31 35
     // if($item->post_type === 'artist' || $item->post_type === 'event' || $item->post_type === 'exhibition') {
32 36
     $posts_with_type = ['artist', 'exhbition', 'event'];
@@ -36,7 +40,7 @@ function default_post_format( $item, $include_content ) {
36 40
     }
37 41
 
38 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 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 Bestand weergeven

@@ -28,7 +28,7 @@ function prepare_related_items($post_ids) {
28 28
     );
29 29
     $related_items = get_posts($args);
30 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 33
     return $collection;
34 34
 }

+ 4
- 9
plugins/cia-post-types/includes/custom-types.php Bestand weergeven

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

+ 5
- 1
vue-theme/src/components/featured-image.vue Bestand weergeven

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

Laden…
Annuleren
Opslaan