change slug for multiple pages with same root
-
Thank you! You really saved my bacon. So grateful!!!
So now that the function identifies the pages that should have the same header, can I use that same format to change things like sidebar colors, etc.? Is there a standard format I can apply?
Quote:..can I use that same format to change things like sidebar colors, etc.?Since each page has an unique ID, you can change sidebar colours etc, with just Custom CSS.
Yes, each page has a unique ID, but the site will evolve with new pages and posts and I doubt my client could go in and ad new IDs to the CSS. I was thinking that now that there is a mechanism to identify the pages that require the secondary style, there could be some way to change items in addition to the header.
Admin
You can add this to the child theme’s
functions.phpfile:/**
* Add custom body class
*/
function my_body_class( $classes ) {
$parent_id = 65; /* Change to the ID of the parent page */
$current_post = get_post( $post_id );
if ( in_array( $parent_id, array( $current_post->ID, $current_post->post_parent ) ) ) $classes[] = 'a-main';
return $classes;
}
add_action( 'body_class', 'my_body_class' );That will add the
.a-mainclass to the<body>element, so you can use that to prefix the CSS codes to be applied to those pages.Ingenious. Thank you so much. You guys are the most responsive developers I’ve come across and when I finally finish this thing and get paid, I will definitely be making a donation to the Graphene cause. Great work and great support. Thank you.
Viewing 6 posts - 11 through 16 (of 16 total)
- 1
- 2
- You must be logged in to reply to this topic.
