Просмотр исходного кода

:bug: totally added formatted sorted items out of order

tags/0.9.0
J 4 лет назад
Родитель
Сommit
85812dfd6a
1 измененных файлов: 6 добавлений и 4 удалений
  1. 6
    4
      plugins/cia-endpoints/includes/class.make-sortby.php

+ 6
- 4
plugins/cia-endpoints/includes/class.make-sortby.php Просмотреть файл

@@ -149,11 +149,13 @@ class Make_Sort_By extends WP_REST_Controller {
149 149
     }
150 150
 
151 151
     public function prepare_items_for_reponse( $items ) {
152
-        $collection = array();
153
-        $formatted = default_post_format($item, false);
154
-        $formatted[hero] = get_post_meta( $post->ID, 'hero_header', true );
152
+        $collection = [];
155 153
         
156
-        forEach( $items as $key => $item ) $collection[$key] = $formatted;
154
+        forEach( $items as $item ) {
155
+            $formatted = default_post_format($item, false);
156
+            $formatted[hero] = get_post_meta( $item->ID, 'hero_header', true );
157
+            array_push($collection, $formatted);
158
+        }
157 159
 
158 160
         return $collection;
159 161
     }

Загрузка…
Отмена
Сохранить