WordPress.org

Make WordPress Core

#23128 closed defect (bug) (fixed)

Twenty Twelve: "Post Author" included as hCard names in comments

Reported by: BrazenlyGeek Owned by: lancewillett
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.5
Component: Bundled Theme Keywords: has-patch needs-testing
Focuses: Cc:

Description

When Twenty Twelve output comments made by the author of the post being viewed, it appends "Post Author" (wrapped in a SPAN) to the comment author's name.

The problem is that the entire thing (author's name & "Post Author") is wrapped in a CITE with hCard class "fn" applied to it.

This causes hCard parsers to consider "Post Author" to be part of the author's full name, as can be verified by parse results here (http://www.google.com/webmasters/tools/richsnippets) when running through Twenty Twelve-powered posts with comments made by the post author.

Line 289 of Twenty Twelve's functions.php is the relevant line; moving "%2$s" to outside the CITE tag is all that's needed, at least to fix the semantics problem (not sure if there's specific styling attached to the SPAN within the CITE or not).

Attachments (3)

23128.diff (1.9 KB) - added by obenland 18 months ago.
23128.3.diff (977 bytes) - added by lancewillett 16 months ago.
23128.2.diff (977 bytes) - added by lancewillett 16 months ago.

Download all attachments as: .zip

Change History (16)

comment:1 SergeyBiryukov18 months ago

  • Component changed from Themes to Bundled Theme

obenland18 months ago

comment:2 obenland18 months ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 3.6
  • Severity changed from trivial to normal

Wrapping it in another span made the most sense to me - might not be the best solution.

comment:3 BrazenlyGeek18 months ago

Could that be simplified by then removing the SPAN surrounding "post author"?

Instead of this:

SPAN CITE name /CITE SPAN post author /SPAN /SPAN

We'd then have this:

SPAN CITE name /CITE post author /SPAN

(Specifically, I mean removing the SPAN tags from line 292, as the remaining SPAN & CITE tags in the above patch ought to be enough to style the whole phrase [name + "post author"] as needed.)

Last edited 18 months ago by BrazenlyGeek (previous) (diff)

comment:4 obenland18 months ago

Hm, I don't think this is really possible. We need some kind of markup to be able to style the badge.

My concerns were more about the fact that we use the tag itself (instead of a class for example) to style it and my diff introduces a second element of the same kind. We also could introduce and use a class to style it, I'm just not sure how that would affect backwards compatibility.

comment:5 BrazenlyGeek18 months ago

Can the outer SPAN itself be removed? So instead we have this:

CITE name /CITE SPAN post author /SPAN

I'm by no means a designer so I'm unsure how that affects the design aspect of it, but the idea of nesting non-semantic SPANs seems a bit much.

comment:6 follow-up: nacin17 months ago

Or we just remove the badge.

comment:7 SergeyBiryukov17 months ago

  • Summary changed from "Post Author" included as hCard names in Twenty Twelve comments to Twenty Twelve: "Post Author" included as hCard names in comments

comment:8 lancewillett17 months ago

This relates a bit to #20088 -- if we retrofit Twenty Twelve to use core markup (and not its own custom callback) this ticket will be obsolete.

comment:9 lancewillett16 months ago

The change in markup could break child theme styles (or sites using Custom CSS on WP.com) that have styled the post author text -- or hidden it, right?

comment:10 in reply to: ↑ 6 lancewillett16 months ago

Replying to nacin:

Or we just remove the badge.

We can't remove the badge since the theme has no other visual indicator of a post author's comments.

comment:11 lancewillett16 months ago

.2 patch uses an HTML-only technique to make the markup more specific without changing CSS at all. Should work perfectly for back compat, no changes needed to child theme CSS.

lancewillett16 months ago

comment:12 obenland16 months ago

Wow, nice patch!

lancewillett16 months ago

comment:13 lancewillett16 months ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In 23716:

Twenty Twelve: update post author comment markup and styles, improving hCard data parsing and simplifying styles. Fixes #23128.

Note: See TracTickets for help on using tickets.