Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#16675 closed defect (bug) (fixed)

Deprecate sticky_class function

Reported by: solarissmoke Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: minor Version: 3.1
Component: Template Keywords: has-patch commit
Focuses: Cc:


I was rummaging around post-template.php and found the sticky_class() function, which was meant to be used by themes like so:

<div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>"> 

Of course now we have

<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">

sticky_class() should be deprecated.

Attachments (1)

16675.diff (1.1 KB) - added by solarissmoke 5 years ago.

Download all attachments as: .zip

Change History (7)

5 years ago

#1 @solarissmoke
5 years ago

  • Keywords has-patch added

#2 @scribu
5 years ago

  • Component changed from General to Template
  • Keywords commit added
  • Milestone changed from Awaiting Review to Future Release

#3 follow-up: @wycks
4 years ago

  • Keywords 2nd-opinion added

I'm not sure this is a great idea post_class only shows 'sticky' for the first page, while sticky_class will be applied to the sticky post on any page ( archives, categories, etc).

As far as I can tell they do not do the same thing.

#4 in reply to: ↑ 3 @solarissmoke
4 years ago

Replying to wycks:

As far as I can tell they do not do the same thing.

Then post_class should be modified to do what sticky_class did for back compat. Point is we should be using post_class to deal with all post classes.

#5 @nacin
3 years ago

  • Keywords 2nd-opinion removed
  • Milestone changed from Future Release to 3.5

sticky_class() and post_class() were both introduced in 2.7. Based on [8637] and [8638] it looks like sticky_class() should have just died then.

+1 to a straight deprecation, with no changes to post_class().

#6 @nacin
3 years ago

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

In [21253]:

Deprecate sticky_class() in favor of post_class(). props solarissmoke, fixes #16675.

Note: See TracTickets for help on using tickets.