slug); endforeach; return $type_slugs; } function default_post_format( $item, $include_content ) { $filtered = []; $filtered[id] = $item->ID; $filtered[slug] = $item->post_name; $filtered[type] = $item->post_type; $filtered[title] = $item->post_title; $filtered[excerpt] = $item->post_excerpt; $filtered[date] = $item->post_date; if($include_content) $filtered[content] = $item->post_content; $filtered[featured] = get_the_post_thumbnail_url($item); // Materials + type endpoints // if($item->post_type === 'artist' || $item->post_type === 'event' || $item->post_type === 'exhibition') { $posts_with_type = ['artist', 'exhbition', 'event']; if( in_array($item->post_type, $posts_with_type) ) { $filtered[materials] = make_taxonomy_endpoint_for( get_the_terms( $item, 'material' ) ); $filtered[subtypes] = make_taxonomy_endpoint_for( get_the_terms( $item, $item->post_type . '_type' ) ); } // Custom fields endpoint if($item->post_type === 'episode') $filtered[credits] = get_post_meta( $item->ID, 'credits', true ); if($item->post_type === 'artist') $filtered[sortname] = get_post_meta( $item->ID, 'artist-sort-name', true ); if($item->post_type === 'event') { $filtered[start] = get_post_meta( $item->ID, 'event-start-time', true ); $filtered[end] = get_post_meta( $item->ID, 'event-end-time', true ); } if($item->post_type === 'exhibition') { $filtered[start] = get_post_meta( $item->ID, 'exhibit-start-date', true ); $filtered[end] = get_post_meta( $item->ID, 'exhibit-end-date', true ); } // Post categories and tags (store just the slugs) if($item->post_type === 'post') { $filtered[categories] = make_taxonomy_endpoint_for(get_the_terms( $item, 'category' )); $filtered[tags] = make_taxonomy_endpoint_for(get_the_terms( $item, 'post_tag' )); } return $filtered; } ?>