echo hh_body_ID(); ?> <?php body_class(); ?> > <script type="text/javascript" src="<?php bloginfo('template_directory'); ?> /media/js/init.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?> /media/js/jquery.validate.js"></script> <script>document.body.className += " <?php echo hh_get_root_parent($post->ID, 1); ?> ";</script> <h1 class="seo">Hello Health</h1> <div id="header"> <div id="header-wrapper" class="container_6"> <div class="grid_6"> <img id="logo" src="<?php bloginfo('template_directory'); ?> /media/images/logo-hello-health.png" alt="Hello Health logo" /> <?php hh_page_menu('header', 'navigation-primary', 'menu', 1); ?> </div>
<div id="cover"> <div class="shadow"></div> <div class="container_6"> <div class="grid_6"> <div id="login"> <img src="<?php bloginfo('template_directory'); ?> /media/images/square.png" alt="" /> <?php $rootPostName = hh_get_root_parent($post->ID, 1); ?> <ul> <li class="first"><a href="/<?php echo $rootPostName; ?> /login/">Login</a></li> <?php if (strtoupper($rootPostName) == strtoupper("physicians")) { // slug ?> <li><a id="support-link" href="http://support.hellohealth.com/providers/" rel="external">Support</a></li> <?php } else { ?> <li><a id="support-link" href="http://support.hellohealth.com/patients/" rel="external">Support</a></li> <?php } ?> </ul> <div class="shadow"></div>
function hh_get_root_parent($pageId, $post_name = 0) { global $wpdb; $parentId = $wpdb->get_var("SELECT post_parent FROM {$wpdb->posts} WHERE post_type='page' AND ID = '{$pageId}'"); if ($parentId == 0) { if ($post_name == 0) { return $pageId; } else { $page = get_page($pageId); return $page->post_name; } } else { return hh_get_root_parent($parentId, $post_name); } }