Custom styling for single pages

Please Note: Theme customizations go beyond the scope of our support services and this article is provided solely as a courtesy to our customers. Please take a moment to review the Scope of our Support.

In some cases you might want to apply some custom styles for a single page on your site, but not to all of the pages. In this case you can use the unique body page ID class that WordPress generates and prepend the class to your CSS snippet.

In order to retrieve the body page ID class, you would have to inspect the code with your browser developer tools (like Firebug on Firefox or by viewing the page source). Here is an example of a body tag using this function:


On this example you can see the following classes added to the body:
page : meaning that this is a page
page-id-161 : the ID of the page is 161
page-template-template-contact-php : the page uses the template file called template-contact.php

So, if for example, you would like to hide the logo on the page with ID 161, you can use the following CSS snippet:

.page-id-161 #logo-container{
Article key words: change specific page, only to a specific page, apply changes to one page only, landing page, remove from one page only

Was this useful? 11