[wp-xmlrpc] API support for post formats?

Eric Mann eric at eam.me
Fri Nov 19 02:57:49 UTC 2010


OK, I've added a new patch.  As I mentioned in my note just before it, I
haven't changed too much.  Basically, you can specify "default" as the value
of a post format and it will be converted to "0" automatically.

The actual, hard-coded post format array is:

$strings <http://phpxref.ftwr.co.uk/wordpress/_variables/strings.html> = array(
    '0'       => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Default',
'Post format' ),
    'aside'   => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Aside',
'Post format' ),
    'chat'    => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Chat',
'Post format' ),
    'gallery' => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Gallery',
'Post format' ),
    'link'    => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Link',
'Post format' ),
    'image'   => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Image',
'Post format' ),
    'quote'   => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Quote',
'Post format' ),
    'status'  => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Status',
'Post format' ),
    'video'   => _x
<http://phpxref.ftwr.co.uk/wordpress/_functions/_x.html>( 'Video',
'Post format' )
);

So you can see a "default" post actually has a post format slug of "0,"
which is what seemed to make no sense when we tested things.  I'm going to
leave the method that returns an array of post formats as-is for now.  It's
returning an accurate slug ("0") even if that seems counterintuitive.  The
same for the methods that get posts, they'll return the set slug for post
formats.

However, the two methods that can set a post format (metaWeblog.newPost and
metaWeblog.editPost) should be more flexible.  After all, we should "be
conservative in what we send, but liberal in what we receive."  So you can
send either "0" or "default" when setting a post format of "default," and
the system will recognize both.

Take a look at the new patch and let me know what you think.  I'd *really *like
to get this committed ASAP ...

~Eric

On Wed, Nov 17, 2010 at 8:06 AM, Daniel Jalkut <jalkut at red-sweater.com>wrote:

> Eric, thanks for picking up and running with this. Great contributions!
>
> Daniel
>
> On Nov 17, 2010, at 11:04am, Eric Mann wrote:
>
> > Thanks for the feedback.  I'll take a look at it tonight when I get done
> with work and see if there's a more elegant way to handle the "default" post
> format.
> >
> > On Tue, Nov 16, 2010 at 11:06 PM, Joseph Scott <joseph at josephscott.org>
> wrote:
> > Sorry for not getting back to this sooner.  I ran through a few tests
> > with your latest patch and found a couple of times, around the
> > 'default' post format.  See
> > http://core.trac.wordpress.org/ticket/15405#comment:8 for details.
> >
> > On Sat, Nov 13, 2010 at 9:56 AM, Eric Mann <eric at eam.me> wrote:
> > > Thanks for the catches.  Those were both typos, and I've fixed both in
> the
> > > newest patch.
> > > wp_set_post_format() should have been wp_set_post_terms() ... Using the
> > > set_post_format() method from this patch as an
> > > example:
> http://core.trac.wordpress.org/attachment/ticket/14746/14746.6.diff
> >
> >
> >
> > --
> > Joseph Scott
> > joseph at josephscott.org
> > http://josephscott.org/
> > _______________________________________________
> > wp-xmlrpc mailing list
> > wp-xmlrpc at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-xmlrpc
> >
> > _______________________________________________
> > wp-xmlrpc mailing list
> > wp-xmlrpc at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-xmlrpc
>
> _______________________________________________
> wp-xmlrpc mailing list
> wp-xmlrpc at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-xmlrpc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.automattic.com/pipermail/wp-xmlrpc/attachments/20101118/16c1c192/attachment.htm>


More information about the wp-xmlrpc mailing list