function getMcClellandMenuName($post, $asLowerCase = true) { if (empty($post->post_parent)) { return $asLowerCase ? strtolower(get_the_title($post->ID)) : get_the_title($post->ID); } else { return getMcClellandMenuName(get_post($post->post_parent), $asLowerCase); } }
function getMcClellandMenuName($post, $asLowerCase = true) { if (empty($post->post_parent)) { $title = str_replace(" ", "-", get_the_title($post->ID)); if ($title == "About-Us") { return $asLowerCase ? "info" : "About Us"; } return $asLowerCase ? strtolower($title) : $title; } else { return getMcClellandMenuName(get_post($post->post_parent), $asLowerCase); } }
?> </a></h3> <?php } ?> <?php wp_reset_postdata(); ?> <?php } ?> </div> </div> <div id="content-cursor" data-post-parent="<?php echo getMcClellandMenuName($post); ?> "></div> </div> <!-- /.content-box --> <?php } else { ?> <?php get_template_part('template-parts/content', 'none'); ?> <?php } ?>
<span class='mobile'><?php echo the_title(); ?> </h2> <?php $submenu = wp_nav_menu(["menu" => getMcClellandMenuName($post), "submenu" => getMcClellandMenuName($post, false), "link_before" => "<span>", "link_after" => "</span>", "echo" => 0]); ?> <?if($submenu):?> <div id="desktop-sub-menu"> <?php echo $submenu; ?> </div> <div class="entry-submenu-holder"> <a href="#" class="entry-submenu-button">☰</a> <div class="entry-submenu <?echo getMcClellandMenuName($post)?>"> <?php echo $submenu; ?> </div> </div> <?endif?> </nav><!-- .entry-header --> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages(array('before' => '<div class="page-links">' . esc_html__('Pages:', 'mcclellandinsurance'), 'after' => '</div>')); ?>