Add top parent page id to body class


I need to have the top parent page id added to the body class of the pages.

Homepage (id:10)
– Sub page (id:11)
— Sub detail page (id:12)

By default it’s like: Sub page gets parent Id 10 in the body class. And Sub detail page gets parent Id 11 in the body class.

What I need is that the sub page detail needs to get the upper top parent id added to the body class so that id 10 is added to the body.

The only thing I can find is what it’s by default. How can I achieve this?

, n00bly 3 years 2020-06-03T03:11:09-05:00 0 Answers 96 views 0

Leave an answer