• I changed a few of my files from page template files to single use custom templates. In the source code the body_class is still pulling in the page template names even after I’ve deleted those files.

    Is this a normal thing and is there a way to fix this?

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What are the classes that shouldn’t be there? Please provide a link to a page on your site where we can see this. Thanks. Note: Your link will be public and we will not later remove it.

    Thread Starter tkmets5

    (@tkmets5)

    https://3c4cabd28e18.ngrok.io/

    All 3 pages were originally set up as page templates. I changed home to page-home and the other 2 pages are just going off of page.php.

    <body class="page-template page-template-template-work page-template-template-work-php page page-id-8">

    Thanks for the help…

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I wonder if your theme is doing something here.

    For a test, switch to twentytwenty. When you switch back, is it the same?

    I like to use the plugin “show current template” as it shows all the PHP files used to render a page. Check to see how your theme is rendering the page.

    Thread Starter tkmets5

    (@tkmets5)

    I tried the switch and back but still the same. Thanks for the tip on that plugin…it’s perfect. My loop on page.php is pulling in content-page….but that shouldn’t make the output in body_class show page-template? Should it? It’s having no affect on my site other than triggering my ocd.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    No, that’s probably coming in via the get_template_part call in your page.php file.

    Thread Starter tkmets5

    (@tkmets5)

    yeah it is…I tried everything, I even tried removing the body_class and adding it back.
    I guess I’ll keep digging around, I appreciate the help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Unused classes remain in body_class()’ is closed to new replies.