[wp-trac] [WordPress Trac] #23347: Theme fallbacks for post format meta data
WordPress Trac
noreply at wordpress.org
Tue Feb 19 20:41:37 UTC 2013
#23347: Theme fallbacks for post format meta data
-------------------------+------------------
Reporter: helen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.6
Component: Template | Version:
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------
Comment (by nacin):
== The Different Situations ==
'''Three theme situations:'''
1. Theme doesn't support post formats
2. Theme supports old-style post formats
3. Theme supports new-style "structured" post formats
'''A — Three fallback situations:'''
1. Theme does not support a format, but the post has new-style
"structured" post format data
* '''Fallback:''' Turn new-style structured data into HTML and use
the_content filter
2. Theme supports a format (old-style), but the post has new-style
"structured" post format data
* '''Fallback:''' Turn new-style structured data into HTML and use
the_content filter
3. Theme supports a format (new-style), but the post has old-style
unstructured post content
* '''Fallback:''' Parse out post_content into individual pieces of post
format data. (This needs to occur, because this theme wouldn't necessarily
have a call to the_content() for all post formats, would it?)
'''B — Three situations where do not 'fall back':'''
1. Theme does not support a post format, and the post has old-style
unstructured post content
2. The theme supports a format (old-style), and the post has old-style
unstructured post content
3. Theme supports a format (new-style), and the post has new-style post
format data
To reorganize these content situations based on the individual theme
situations: (someone can turn this into a flowchart if they'd like)
1. Theme doesn't support a post format:
* The post has new-style "structured" post format data. '''Fallback:'''
Turn it into HTML, use the_content.
* The post has old-style post content: Do nothing.
2. Theme supports a post format, old-style:
* The post has new-style post format data: '''Fallback:''' Turn it into
HTML, use the_content.
* The post has old-style post content: Do nothing.
3. The theme supports a post format, new-style:
* The post has new-style post-format data: Do nothing.
* The post has old-style post content: '''Fallback:''' Parse
post_content into pieces of post format data.
== Old versus New Formats ==
It is clear here that a theme not supporting a format is pretty much the
same as supporting old-style formats. This is even more apparently now
that we will be allowing a user to use any formats they wish, even if the
theme does not support it, so the old-style "support" becomes pretty close
to meaningless.
Also, since each format is individually supported or not supported, you
could have many of these situations occurring on the same site, without a
teme switch:
* '''A theme supports the quote format, with new-style structured data'''
(B3)
* The site also has chat posts written with metadata (A1 — must convert
these into HTML)
* The site has link formats without metadata (B1 — show these as-is)
* It also has old-style quotes (A3 — must parse these into pieces)
Or:
* '''A theme supports the quote format, old-style''' (B2)
* The site has quote formats written with metadata (A2 — must convert
these into HTML)
* The site has chat posts written with metadata (A1 — must convert these
into HTML)
* The site has chat posts written without metadata (B1)
== Theme Support ==
It is probably apparent by now that we need to know when a theme supports
a new-style format in particular. Whether the theme supports an old-style
format in only has to do with whether the theme has a particular design
for that format, and isn't very helpful anymore.
To make this change, I suggest we come up with a new theme support
argument. Specifically, structured-post-formats:
{{{
add_theme_support( 'structured-post-formats', array( 'quote' ) );
}}}
This would replace post-formats support. It is a trivial change, but would
be necessary because themes would have to make bigger changes anyway —
specifically, switch to new template tags to support the new-style
metadata.
Under the hood, we could automatically register support for post-formats
when structured-post-formats is registered. Then you can have checks like
`current_theme_supports( 'post-formats' ) && ! current_theme_supports(
'structured-post-formats' )` to see if a theme supports post formats
generally, but not the newer structured ones. (Note that I would prevent
in code the ability for a theme to say "Yes I support these formats" with
some being old-style, others being new-style. As said above, there is no
purpose for this — in terms of working with content, supporting old-style
is the same as not having the format supported at all. So it is best to
avoid such an API rift.)
== Compatibility Across WordPress Versions ==
If a theme wishes to remain compatible with 3.5 while still supporting 3.6
methods, they'll need to do a few things. (I would recommend doing this
for Twenty Ten and Twenty Eleven, and leaving Twenty Twelve for 3.6+ only,
to set different examples and to keep 3.6 clean. Supporting forward for an
older theme is important; supporting backward for a newer theme is not.)
1. They'd need to call add_theme_support() for both post-formats and
structured-post-formats. The former would get ignored in 3.6, the latter
would get ignored in 3.5.
2. They'd need to function_exists( 'get_post_format_meta' ) before using
the new-style functions. In their `else`, they'd use the_content() as
before.
== Feeds ==
One final note, everything goes out the window when dealing with an RSS
feed. Everything needs to be piped back into the_content(). `is_feed()`
does not appear to be accounted for in [23450].
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23347#comment:25>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list