Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9514 closed enhancement (fixed)

Add 'page' class to the get_body_class() function

Reported by: nathanrice's profile nathanrice Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: Themes Keywords: has-patch tested
Focuses: Cc:

Description

Currently, there is no 'page' class assigned to the $classes array in the get_body_class() function. Consequently, there would be no way for CSS to target "all pages" with a single selector.

This is my first ticket, so I hope I did this the right way.

I've attached a diff file that adds the following code to wp-includes/post-template.php within the is_page() conditional:

if ($pageID != get_option('page_for_posts'))
	$classes[] = 'page';

I feel like this is an important addition to the classes that this function generates.

Attachments (1)

post-template.diff (370 bytes) - added by nathanrice 16 years ago.
post-template.php diff file to add page class to get_body_class()

Download all attachments as: .zip

Change History (6)

#1 follow-up: @filosofo
16 years ago

I think the conditional is unnecessary; is_page() will be false when querying the page_for_posts page.

#2 in reply to: ↑ 1 @nathanrice
16 years ago

Replying to filosofo:

I think the conditional is unnecessary; is_page() will be false when querying the page_for_posts page.

Good call. I'm attaching a new diff file that just adds the 'page' class without the conditional.

@nathanrice
16 years ago

post-template.php diff file to add page class to get_body_class()

#3 @jbsil
16 years ago

  • Keywords has-patch tested added

Simple fix. Works on my end.

#4 @ryan
16 years ago

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

(In [10950]) Add page class to get_boddy_class(). Props nathanrice. fixes #9514

#5 @nathanrice
16 years ago

Thanks Ryan!!!

Note: See TracTickets for help on using tickets.