Title: pgapepper's Replies | WordPress.org

---

# pgapepper

  [  ](https://wordpress.org/support/users/pgapepper/)

 *   [Profile](https://wordpress.org/support/users/pgapepper/)
 *   [Topics Started](https://wordpress.org/support/users/pgapepper/topics/)
 *   [Replies Created](https://wordpress.org/support/users/pgapepper/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/pgapepper/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/pgapepper/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/pgapepper/engagements/)
 *   [Favorites](https://wordpress.org/support/users/pgapepper/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Dynamic body classes](https://wordpress.org/support/topic/dynamic-body-classes/)
 *  Thread Starter [pgapepper](https://wordpress.org/support/users/pgapepper/)
 * (@pgapepper)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/dynamic-body-classes/#post-1651676)
 * I skimmed through the code a couple of times and didn’t see missing close. Either
   way, you are a rockstar and I owe you a beer. Viewing the source code after the
   fix, all pages are assigned the appropriate body classes. Again, thanks for all
   your help – I owe you big!
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Dynamic body classes](https://wordpress.org/support/topic/dynamic-body-classes/)
 *  Thread Starter [pgapepper](https://wordpress.org/support/users/pgapepper/)
 * (@pgapepper)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/dynamic-body-classes/#post-1651643)
 * Leaving the following in:
 *     ```
       if (apply_filters('thematic_show_bodyclass',TRUE)) {
           Creating the body class
           ?>
       ```
   
 *  (or taking it out – either way it makes no difference)
    and replacing `<body
   class="<?php thematic_body_class() ?>">` with
 *     ```
       <?php if($post->post_parent)
       {  $ancestors=get_post_ancestors($post->ID);
          $root=count($ancestors)-1;
          $parent = $ancestors[$root];
          $top_page = get_post($parent); }
       else
       { $top_page = $post; }
       $top_page_name = $top_page->post_name;
       if ( $top_page_name != 'school' && $top_page_name != 'early-childhood-education' ) $top_page_name = 'trinity';
       ?>
       <body<?php if($top_page_name) { echo ' class="' . $top_page_name . '"'; ?>>
       ```
   
 * results is the following error:
 * > Parse error: syntax error, unexpected $end in ……/wp-content/themes/thematic/
   > header.php on line 96
 * As an aside, I am oviously using the thematic theme as a framework (I also changed
   the naming conventions of the classes to match page slugs already in place). 
   Thanks again for all of your help.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Dynamic body classes](https://wordpress.org/support/topic/dynamic-body-classes/)
 *  Thread Starter [pgapepper](https://wordpress.org/support/users/pgapepper/)
 * (@pgapepper)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/dynamic-body-classes/#post-1651600)
 * Thanks for the quick response, alcymyth. The site is currently located at trinity.
   versiostudios.com while it’s being built and sandboxed. I should have included
   the url (sorry) in the original post. I’ll try and implement your solution, but
   what would happen if the .church class needs to apply to all pages, except those
   specified as parent/child of posts 30 or 32? Grandchildren will exist also. I
   would think it’d be a simple if / elseif / else, right?

Viewing 3 replies - 1 through 3 (of 3 total)