Created
November 17, 2015 16:09
-
-
Save lancewillett/43970499eef7236d48ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/json-endpoints/class.wpcom-json-api-get-site-endpoint.php b/json-endpoints/class.wpcom-json-api-get-site-endpoint.php | |
index e6f589f..1a259d3 100644 | |
--- a/json-endpoints/class.wpcom-json-api-get-site-endpoint.php | |
+++ b/json-endpoints/class.wpcom-json-api-get-site-endpoint.php | |
@@ -444,19 +444,24 @@ class WPCOM_JSON_API_List_Post_Formats_Endpoint extends WPCOM_JSON_API_Endpoint | |
$this->load_theme_functions(); | |
} | |
- // Get a list of supported post formats. | |
- $all_formats = get_post_format_strings(); | |
- $supported = get_theme_support( 'post-formats' ); | |
+ $args = array( | |
+ 'child_of' => 0, | |
+ 'exclude' => '', | |
+ 'hide_empty' => false, | |
+ 'hierarchical' => 0, | |
+ 'order' => 'ASC', | |
+ 'orderby' => 'name', | |
+ 'pad_counts' => false, | |
+ ); | |
- $supported_formats = $response['formats'] = array(); | |
+ $terms = get_terms( 'post_format', $args ); | |
+ $formats = array(); | |
- if ( isset( $supported[0] ) ) { | |
- foreach ( $supported[0] as $format ) { | |
- $supported_formats[ $format ] = $all_formats[ $format ]; | |
- } | |
+ foreach ( $terms as $format ) { | |
+ $formats[$format->term_id] = $format->name; | |
} | |
- $response['formats'] = (object) $supported_formats; | |
+ $response['formats'] = $formats; | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment