WordPress Trac: Ticket #17094: Add support for fetching postFormats supported by the active themehttps://core.trac.wordpress.org/ticket/17094
<p>
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.
</p>
<p>
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.
</p>
en-usWordPress Trachttps://core.trac.wordpress.org/chrome/site/your_project_logo.pnghttps://core.trac.wordpress.org/ticket/17094
Trac 1.0.1daniloercoliSat, 09 Apr 2011 15:11:50 GMTcc sethttps://core.trac.wordpress.org/ticket/17094#comment:1
https://core.trac.wordpress.org/ticket/17094#comment:1
<ul>
<li><strong>cc</strong>
<em>ercoli@…</em> added
</li>
</ul>
TicketnacinSat, 09 Apr 2011 15:16:30 GMTmilestone changedhttps://core.trac.wordpress.org/ticket/17094#comment:2
https://core.trac.wordpress.org/ticket/17094#comment:2
<ul>
<li><strong>milestone</strong>
changed from <em>Awaiting Review</em> to <em>3.2</em>
</li>
</ul>
<p>
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.
</p>
<p>
I believe that concern was expressed by josephscott originally. The change came out of <a class="closed ticket" href="https://core.trac.wordpress.org/ticket/15405" title="task (blessed): Extend Post Format support to the XML-RPC API (closed: fixed)">#15405</a>, but that may have come from a conversation in IRC.
</p>
<p>
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.
</p>
TicketjosephscottSat, 09 Apr 2011 17:49:48 GMThttps://core.trac.wordpress.org/ticket/17094#comment:3
https://core.trac.wordpress.org/ticket/17094#comment:3
<p>
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.
</p>
<p>
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:
</p>
<pre class="wiki">Array (
[all] =&gt; Array (
[standard] =&gt; Standard
[aside] =&gt; Aside
[chat] =&gt; Chat
[gallery] =&gt; Gallery
[link] =&gt; Link
[image] =&gt; Image
[quote] =&gt; Quote
[status] =&gt; Status
[video] =&gt; Video
[audio] =&gt; Audio
)
[supported] =&gt; Array (
[0] =&gt; aside
[1] =&gt; gallery
)
)
</pre><p>
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.
</p>
<p>
To get the additional data the method call would be wp.getPostFormats( 'blog_id', 'username', 'password', array( 'show-supported' =&gt; TRUE ) ).
</p>
<p>
For reference the current response looks like:
</p>
<pre class="wiki">Array (
[standard] =&gt; Standard
[aside] =&gt; Aside
[chat] =&gt; Chat
[gallery] =&gt; Gallery
[link] =&gt; Link
[image] =&gt; Image
[quote] =&gt; Quote
[status] =&gt; Status
[video] =&gt; Video
[audio] =&gt; Audio
)
</pre><p>
I'm putting this on my list of XML-RPC tickets for WP 3.2 (which I'll post on wpdevel later).
</p>
TicketjosephscottMon, 11 Apr 2011 17:56:16 GMTattachment sethttps://core.trac.wordpress.org/ticket/17094
https://core.trac.wordpress.org/ticket/17094
<ul>
<li><strong>attachment</strong>
set to <em>rpc.diff</em>
</li>
</ul>
TicketdaniloercoliTue, 12 Apr 2011 14:55:35 GMThttps://core.trac.wordpress.org/ticket/17094#comment:4
https://core.trac.wordpress.org/ticket/17094#comment:4
<p>
+1 I like your proposed solution.
</p>
TicketjaneTue, 12 Apr 2011 22:21:40 GMTkeywords changedhttps://core.trac.wordpress.org/ticket/17094#comment:5
https://core.trac.wordpress.org/ticket/17094#comment:5
<ul>
<li><strong>keywords</strong>
<em>has-patch</em> <em>needs-testing</em> added
</li>
</ul>
TicketjosephscottMon, 18 Apr 2011 17:27:31 GMTstatus changed; resolution sethttps://core.trac.wordpress.org/ticket/17094#comment:6
https://core.trac.wordpress.org/ticket/17094#comment:6
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
(In <a class="changeset" href="https://core.trac.wordpress.org/changeset/17650" title="Add support to wp.getPostFormats to provide a list of the currently ...">[17650]</a>) Add support to wp.getPostFormats to provide a list of the currently supported post formats in addition to the complete list.
</p>
<p>
Fixes <a class="closed ticket" href="https://core.trac.wordpress.org/ticket/17094" title="enhancement: Add support for fetching postFormats supported by the active theme (closed: fixed)">#17094</a>
</p>
Ticket