WordPress.org

Ready to get started?Download WordPress

Forums

Setting a different appearance for page and subpages (how to?) (2 posts)

  1. Urithrand
    Member
    Posted 1 year ago #

    Hi, I bet this question has been asked a million times but I'm very new to website design and only installed WP for the first time a few days ago.

    Basically I've set up a complete custom CSS for my site based in a child theme. What I want is for a page and all subsequent subpages of it to have the same appearance but in a different colour scheme. Is there a simple way to achieve this please?

    Any and all help appreciated but please remember I am new to this and am only just experimenting so try to keep the jargon to a minimum if you wouldn't mind :)

    Regards,

    Uri.

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    Try it by incorporating the body_class in your theme: http://codex.wordpress.org/Function_Reference/body_class

    This will add classes like this on child pages:
    <body class="page page-id-1481 page-parent page-child parent-pageid-37 page-template-default logged-in admin-bar no-customize-support custom-font-enabled">

    Style child pages of a parent page (with an id of 37) like this example:

    .parent-pageid-37.page-child #content {
    color: red;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic