Request: CSS body class for top level parent page (4 posts)

  1. Jack
    Posted 2 years ago #

    Now the class range is 'page page-id-12933 page-child parent-pageid-12932', but there is no class for a top level page.

    In my case I wanted to give a page and all of it's sub(sub,sub etc.) pages a different margin and padding. In the example above parent-pageid-12932 is already a childpage of a top level page, but it's not mentioned in the body classes.

    If it were, I could declare styles for all pages like this:

    body.top-level-page.page-child {

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Can you post a link to a page demonstrating the problem?

  3. Jack
    Posted 2 years ago #

    Well, it's not really a problem, more something about efficiency.

    On the page below I have blog pages and other pages, and I have a portfolio with photographs, created with the NextGen plugin. For both group of pages I need a different top margin for the sidebar. Now I used a bunch of body classes, like body.page-id, but all that could have been accomplished if I could just have the /fotografie page and all of its children have an different top margin. At this moment that doesn't sound like a big deal, but soon there will be dozens of pages and sub(sub)pages with photographs.


  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Why not create a custom page template for these pages and then use the generated page template class on the body tag?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.