When styling pages, I find it helpful to style the page based on the slug, not
the page id. Makes
going back and editing my CSS much easier. I added the following line and am
submitting it as a
suggestion for a future version of Sandbox:
----
// Page author for BODY on 'pages'
elseif ( is_page() ) {
$pageID = $wp_query->post->ID;
$page_children = wp_list_pages("child_of=$pageID&echo=0");
the_post();
$c[] = 'page pageid-' . $pageID;
$c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));
// HERE'S MY ADDITION:
$c[] = 'page-name-' . $wp_query->post->post_name;
// Checks to see if the page has children and/or is a child page; props to Adam
if ( $page_children )
$c[] = 'page-parent';
if ( $wp_query->post->post_parent )
$c[] = 'page-child parent-pageid-' . $wp_query->post->post_parent;
if ( is_page_template() ) // Hat tip to Ian, themeshaper.com
$c[] = 'page-template page-template-' . str_replace( '.php', '-php', get_post_meta(
$pageID, '_wp_page_template', true ) );
rewind_posts();
}
----
Now, in my CSS file, instead of this:
body.pageid-4 h2 { /*styles*/}
I can do this:
body.page-name-contact h2 { /*styles*/ }
I <3 Sandbox. Thank you.
Original issue reported on code.google.com by arloguth...@gmail.com on 27 Dec 2009 at 7:41
Original issue reported on code.google.com by
arloguth...@gmail.com
on 27 Dec 2009 at 7:41