• Hi.

    I come from React development, and I’m (very) new to WP, trying to make a theme for a client.

    I have a page (parent) that has a set of child/sub pages. I want to let the content manager of the site to be able to set a specific color attribute on the subpage, that then will be applied on certain elements on the subpage, and potentially even on the specific the sub page’s own sub pages.

    I have no idea how to achieve this in WP, so what I’m pondering right now is if I can somehow attach categories and sub categories to the sub page, and then somehow extract this in theme.json or perhaps through some PHP-magic in the functions.php file.

    If anyone have a tip for me, that would be great.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s somewhat theme dependent, but there are typically a number of body class attribute values that can be useful in targeting certain pages with specific CSS styling. For example, at least with my theme, classes include ones such as page-id-621 page-child parent-pageid-365.

    If what’s available by default is not adequate, you can use the “body_class” filter to conditionally add other useful body class attribute values.

Viewing 1 replies (of 1 total)
  • The topic ‘Parent page attribute(s) -> inherit in all subpages’ is closed to new replies.