Opened 16 years ago
Closed 15 years ago
#11331 closed enhancement (wontfix)
get_body_class() does not include page-{slug}-php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | trivial | Version: | 3.0 |
Component: | General | Keywords: | has-patch 2nd-opinion |
Focuses: | Cc: |
Description
I have a Glossary page whose slug is "glossary". I created a page-glossary.php to utilize the new WP 2.9 functionality. I was expecting that "page-glossary-php" to be listed among the classNames but instead "page-template-default" was included. Maybe this would better be manifested as a "page-slug-glossary" className just as there is a "page-id-XX".
Attachments (3)
Change History (10)
#2
@
15 years ago
- Keywords has-patch 2nd-opinion added; needs-patch removed
- Version changed from 2.9 to 3.0
added page-slug-xxxxx as a class name for all pages, not just for pages with custom page template file.
#3
@
15 years ago
The slug should get passed through sanitize_html_class()
to ensure only valid characters are used, as is done for the other slug-based class names. See 11331.diff.
@
15 years ago
Same as 11331.diff, but with spaces added to calls in that function. Separate issue, sure, but it's localized, trivial, and one step towards coding standards compliance.
#5
follow-up:
↓ 7
@
15 years ago
I'm not sure about this. With this patch, we may be generating some very long class names, and I don't think we use slugs anywhere else in body|post_class.
We already support page template names and page IDs, we don't support post slugs for example, only post IDs.
#7
in reply to:
↑ 5
@
15 years ago
- Milestone 3.0 deleted
- Resolution set to wontfix
- Status changed from new to closed
Replying to nacin:
I'm not sure about this. With this patch, we may be generating some very long class names, and I don't think we use slugs anywhere else in body|post_class.
I agree.
If you really need this, you have the 'body_class' filter.
Besides, you can add extra CSS from your page-glossary.php template:
<?php function extra_styles() { wp_enqueue_style('glossary', get_bloginfo('stylesheet_directory') . '/glossary.css'); } add_action('wp_print_styles', 'extra_styles'); get_header(); ...
All enhancements are punted to 3.0.