Opened 13 years ago
Closed 13 years ago
#17094 closed enhancement (fixed)
Add support for fetching postFormats supported by the active theme
Reported by: | daniloercoli | Owned by: | |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | XML-RPC | Keywords: | mobile has-patch needs-testing |
Focuses: | Cc: |
Description
Noticed that wp.getPostFormats always returns the full list of Formats, even if the active theme doesn’t support most of them. It just calls get_post_format_strings() to get the list.
I recently added the support for postFormat into WordPress 4 BlackBerry and the users feedback confirm that showing the full list is not so good, because the dashboard instead shows only the post_formats supported by the theme. We should use the same behavior on both places.
Attachments (1)
Change History (7)
#3
@
13 years ago
Adding a parameter to wp.getPostFormats to indicate that you want a list of supported formats as well is reasonable. The question that comes up is how to do that in a reasonable way.
I've put together a patch that adjusts the reply to provide both all of the formats and the currently supported ones. When this is requested the response will look like:
Array ( [all] => Array ( [standard] => Standard [aside] => Aside [chat] => Chat [gallery] => Gallery [link] => Link [image] => Image [quote] => Quote [status] => Status [video] => Video [audio] => Audio ) [supported] => Array ( [0] => aside [1] => gallery ) )
The idea is that clients that specifically ask for this will know that the response format has changed slightly. I'm not entirely thrilled with this approach but given the current constraints it seems like a possibly reasonable trade off.
To get the additional data the method call would be wp.getPostFormats( 'blog_id', 'username', 'password', array( 'show-supported' => TRUE ) ).
For reference the current response looks like:
Array ( [standard] => Standard [aside] => Aside [chat] => Chat [gallery] => Gallery [link] => Link [image] => Image [quote] => Quote [status] => Status [video] => Video [audio] => Audio )
I'm putting this on my list of XML-RPC tickets for WP 3.2 (which I'll post on wpdevel later).
The main issue here is that it would require an additional XML-RPC call to fetch which formats are supported. If you store this information in memory, you won't know when to refresh it, so you'll need to deal with that as well.
I believe that concern was expressed by josephscott originally. The change came out of #15405, but that may have come from a conversation in IRC.
I imagine we should at least add a parameter that allows you to only ask for what is specifically supported. I'm fine with that for 3.2, and it should allow app makers to then make these decisions on their own.