slug); } 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) { $content = $item->post_content; $content = apply_filters('the_content', $content); $filtered[content] = wp_specialchars_decode($content); } if(!$filtered[excerpt]) { $excerpt = get_the_excerpt($item); $filtered[excerpt] = wp_specialchars_decode($excerpt); } $filtered[featured] = get_the_post_thumbnail_url($item); if(!$filtered[featured]) { $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true ); $filtered[featured] = get_post($thumbnailId)->guid; } $filtered[thumb] = get_the_post_thumbnail_url($item, 'medium'); if(!$filtered[thumb]) { $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true ); $filtered[thumb] = get_post($thumbnailId)->guid; } $filtered[hero] = get_post_meta( $item->ID, 'hero_header', true ); // Materials + type endpoints $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' && $include_content) $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 ); $posts_with_date = ['exhbition', 'event']; if( in_array($item->post_type, $posts_with_date) ) { $filtered[start] = get_post_meta($item->ID, $item->post_type . '-start-time', true); $filtered[end] = get_post_meta($item->ID, $item->post_type . '-end-time', true); $filtered[current] = time() <= (int)$filtered[end] && time() >= (int)$filtered[start]; } // 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; } function minimal_post_format( $item ) { $filtered = []; $filtered[id] = $item->ID; $filtered[slug] = $item->post_name; $filtered[type] = $item->post_type; $filtered[title] = $item->post_title; $filtered[date] = $item->post_date; $filtered[thumb] = get_the_post_thumbnail_url($item, 'medium'); if(!$filtered[thumb]) { $thumbnailId = get_post_meta( $item->ID, '_thumbnail_id', true ); $filtered[thumb] = get_post($thumbnailId)->guid; } $posts_with_date = ['exhbition', 'event']; if( in_array($item->post_type, $posts_with_date) ) { $filtered[start] = get_post_meta($item->ID, $item->post_type . '-start-time', true); $filtered[end] = get_post_meta($item->ID, $item->post_type . '-end-time', true); $filtered[current] = time() <= (int)$filtered[end] && time() >= (int)$filtered[start]; } // 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; } ?>