浏览代码

:bug: adding feature images even if no related parent_id

tags/0.9.0
j 4 年前
父节点
当前提交
bb764c4cc6
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      plugins/cia-endpoints/includes/formats.php

+ 4
- 1
plugins/cia-endpoints/includes/formats.php 查看文件

22
     if($include_content) $filtered[content] = $item->post_content;
22
     if($include_content) $filtered[content] = $item->post_content;
23
 
23
 
24
     $filtered[featured] = get_the_post_thumbnail_url($item);
24
     $filtered[featured] = get_the_post_thumbnail_url($item);
25
-
25
+    if(!$filtered[featured]) {
26
+        $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true );
27
+        $filtered[featured] = get_post($thumbnailId)->guid;
28
+    }
26
 
29
 
27
     // Materials + type endpoints
30
     // Materials + type endpoints
28
     // if($item->post_type === 'artist' || $item->post_type === 'event' || $item->post_type === 'exhibition') {
31
     // if($item->post_type === 'artist' || $item->post_type === 'event' || $item->post_type === 'exhibition') {

正在加载...
取消
保存