Selaa lähdekoodia

:bug: adding excerpt to p2p mimimum formats | #148

tags/0.9.0
J 4 vuotta sitten
vanhempi
commit
7ec55bde05
1 muutettua tiedostoa jossa 14 lisäystä ja 2 poistoa
  1. 14
    2
      plugins/cia-endpoints/includes/formats.php

+ 14
- 2
plugins/cia-endpoints/includes/formats.php Näytä tiedosto

@@ -64,7 +64,7 @@ function default_post_format( $item, $include_content ) {
64 64
     // Post categories and tags (store just the slugs)
65 65
     if($item->post_type === 'post') {
66 66
         $filtered[categories] = make_taxonomy_endpoint_for(get_the_terms( $item, 'category' ));
67
-        $filtered[tags] = make_taxonomy_endpoint_for(get_the_terms( $item, 'post_tag' ));
67
+        // $filtered[tags] = make_taxonomy_endpoint_for(get_the_terms( $item, 'post_tag' ));
68 68
     }
69 69
 
70 70
     if($item->related_episode) {
@@ -74,7 +74,7 @@ function default_post_format( $item, $include_content ) {
74 74
     return $filtered;
75 75
 }
76 76
 
77
-function minimal_post_format( $item ) {
77
+function minimal_post_format( $item, $include_excerpt ) {
78 78
     $filtered = [];
79 79
     $filtered[id] = $item->ID;
80 80
     $filtered[slug] = $item->post_name;
@@ -87,7 +87,19 @@ function minimal_post_format( $item ) {
87 87
         $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true );
88 88
         $filtered[thumb] = get_post($thumbnailId)->guid;
89 89
     }
90
+    
91
+    // Always include a small excerpt for artists
92
+    // because they appear on the episode page
93
+    $posts_with_excerpt = ['artist'];
94
+    if( in_array($item->post_type, $posts_with_excerpt) ) {
95
+        $filtered[excerpt] = $item->post_excerpt;
96
+        if(!$filtered[excerpt]) {
97
+            $excerpt = get_the_excerpt($item);
98
+            $filtered[excerpt] = wp_specialchars_decode($excerpt);
99
+        }
100
+    }
90 101
 
102
+    // Always include a date for date based types
91 103
     $posts_with_date = ['exhbition', 'event'];
92 104
     if( in_array($item->post_type, $posts_with_date) ) {
93 105
         $filtered[start] = get_post_meta($item->ID, $item->post_type . '-start-time', true);

Loading…
Peruuta
Tallenna