Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21238 closed defect (bug) (fixed)

Twenty Twelve: Sticky badge on single view

Reported by: obenland's profile obenland Owned by: lancewillett's profile 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 12 years ago.
Broken badge
21238.diff (506 bytes) - added by obenland 12 years ago.
Don't show if is single
21238.2.diff (524 bytes) - added by DrewAPicture 12 years ago.
Incrememntal, adds is_archive check in content.php
21238.3.diff (502 bytes) - added by obenland 12 years ago.
Lets make our lives a little easier and only check for is_home

Download all attachments as: .zip

Change History (13)

#1 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.5

@obenland
12 years ago

Don't show if is single

#2 follow-up: @DrewAPicture
12 years 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

@DrewAPicture
12 years ago

Incrememntal, adds is_archive check in content.php

@obenland
12 years ago

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

#3 in reply to: ↑ 2 @DrewAPicture
12 years 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. :)

#4 @lancewillett
12 years ago

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

#5 @lancewillett
12 years 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.

#6 follow-up: @nacin
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#7 in reply to: ↑ 6 @lancewillett
12 years ago

Replying to nacin:

Nacin, something left to fix?

#8 follow-up: @nacin
12 years 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.

#9 in reply to: ↑ 8 @lancewillett
12 years 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.