Changeset 8382 for sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-rest/wordpresstv-rest.php
- Timestamp:
- 03/01/2019 09:28:58 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-rest/wordpresstv-rest.php
r8379 r8382 85 85 'permalink' => get_permalink( get_the_ID() ), 86 86 'thumbnail' => $thumbnail, 87 'date' => get_the_date(),88 'description' => $post->post_excerpt,87 'date' => $post->post_date_gmt, 88 'description' => get_the_excerpt(), 89 89 'slides' => get_post_meta( $post->ID, '_wptv_slides_url', true ), 90 90 'speakers' => array(), … … 93 93 'tags' => array(), 94 94 'category' => array(), 95 'year' => false,96 'location' => false,95 'year' => array(), 96 'location' => array(), 97 97 'producer' => array(), 98 98 'video' => array( … … 110 110 // Special Cases 111 111 if ( 'category' == $tax && $t->parent == 91093 /* Year */ ) { 112 $video['year'] = $t->name; 112 $video['year'] = array( 113 'slug' => $t->slug, 114 'name' => $t->name, 115 'link' => get_term_link( $t ) 116 ); 113 117 continue; 114 118 } elseif ( 'category' == $tax && $t->parent == 6418 /* Location */ ) { 115 $video['location'] = $t->name; 119 $video['location'] = array( 120 'slug' => $t->slug, 121 'name' => $t->name, 122 'link' => get_term_link( $t ) 123 ); 116 124 continue; 117 125 } … … 130 138 if ( $producer_username = get_the_terms( get_the_ID(), 'producer-username' ) ) { 131 139 $video['producer']['username'] = $producer_username[0]->name; 140 $video['producer']['link'] = 'https://profiles.wordpress.org/' . urlencode( $producer_username[0]->name ) . '/'; 132 141 } 133 142 … … 217 226 switch ( $format ) { 218 227 case 'json': 219 echo json_encode( $response ); 228 header( 'Content-type: application/json' ); 229 echo wp_json_encode( $response ); 220 230 break; 221 231 case 'array': 222 232 if ( defined( 'WPCOM_SANDBOXED' ) && WPCOM_SANDBOXED ) { 233 header( 'Content-Type: text/plain' ); 223 234 print_r( $response ); 224 235 }
Note: See TracChangeset
for help on using the changeset viewer.