WordPress.org

Make WordPress Core

#21238 closed defect (bug) (fixed)

Twenty Twelve: Sticky badge on single view

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

Description

In Twenty Twelve the sticky badge is broken on single view.

It should either be removed entirely or fixed via CSS. The bug didn't occur in Twenty Eleven because a content-single.php template was available.

Attachments (4)

Screen Shot 2012-07-12 at 5.11.23 PM.png (34.6 KB) - added by obenland 21 months ago.
Broken badge
21238.diff (506 bytes) - added by obenland 21 months ago.
Don't show if is single
21238.2.diff (524 bytes) - added by DrewAPicture 21 months ago.
Incrememntal, adds is_archive check in content.php
21238.3.diff (502 bytes) - added by obenland 21 months ago.
Lets make our lives a little easier and only check for is_home

Download all attachments as: .zip

Change History (13)

comment:1 nacin21 months ago

  • Milestone changed from Awaiting Review to 3.5

obenland21 months ago

Broken badge

obenland21 months ago

Don't show if is single

comment:2 follow-up: DrewAPicture21 months ago

  • Cc xoodrew@… added

Per discussion in IRC:

In archives, it looks like the sticky post_class isn't being applied because is_home() && ! is_paged() aren't true (per post-template.php). There's some funkiness with .featured-post because of this this:

Index looks like this: http://cl.ly/3K0e2C192L453N3G1q0b

Archive: http://cl.ly/1T0d3W051C022N0W3D2S

DrewAPicture21 months ago

Incrememntal, adds is_archive check in content.php

obenland21 months ago

Lets make our lives a little easier and only check for is_home

comment:3 in reply to: ↑ 2 DrewAPicture21 months ago

Lets make our lives a little easier and only check for is_home

If you're going to go that route, you might as well just mirror the checks in post-template.php by adding ! is_paged(). There are very valid reasons you might want to highlight Featured/sticky posts outside the homepage. And besides, the lack of 'sticky' post class was the issue on archives anyway. :)

comment:4 lancewillett21 months ago

Correct, the sticky "featured post" badge should only apply on the home page, when not paged.

comment:5 lancewillett21 months ago

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

In [21263]:

Twenty Twelve: show sticky badge only on non-paged home view. Fixes #21238, props DrewAPicture and obenland.

comment:6 follow-up: nacin21 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:7 in reply to: ↑ 6 lancewillett21 months ago

Replying to nacin:

Nacin, something left to fix?

comment:8 follow-up: nacin21 months ago

I don't really like [21263]. <article> uses post_class() which means it will receive the .sticky class if is_sticky() && is_home() && ! is_paged(). If we can make this markup redundant, then this conditional is also redundant. I would rather rely on the existing classes than creating a new div and our own class.

comment:9 in reply to: ↑ 8 lancewillett21 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Replying to nacin:

I don't really like [21263]. <article> uses post_class() which means it will receive the .sticky class if is_sticky() && is_home() && ! is_paged().

Chatted about this in #wordpress-dev IRC channel today, and agreed on keeping the conditional here as the solution isn't just a style hook where the post_class would be sufficient.

nacin: lancewillett: let me know if my comment on #21238 doesn't make sense
nacin: lancewillett: looking at the code, it doesn't look like it makes sense
lancewillett: I don't think we can use a post_class value to hide the extra markup
nacin: I thought the conditional was about styling, not about an extra piece of markup.
lancewillett: Some kind of logic is needed to add it in
lancewillett: Right, exactly
Note: See TracTickets for help on using tickets.