protected function addBodyDataClasses()
    {
        add_filter('body_class', function ($body) {
            global $wp_query;

            // Get the template hierarchy from WordPress
            $templates = $this->hierarchy->getTemplates($wp_query);

            // Reverse the templates returned from $this->hierarchy
            $templates = array_reverse($templates);

            // Add app-data to classes array
            $classes[] = 'app-data';

            foreach ($templates as $template) {
                // Exclude .blade.php and index.php
                if (strpos($template, '.blade.php') || $template === 'index.php') {
                    continue;
                }

                // Exclude index as we use app
                if ($template === 'index') {
                    $template = 'index.php';
                }

                // Replace .php with -data and add to the classes array
                $classes[] = basename(str_replace('.php', '-data', $template));
            }

            // Return the new body class list for WordPress
            return array_merge($body, $classes);
        });
    }