Solved

Applying independent stylesheets to individual wordpress pages

Posted on 2015-01-02
5
185 Views
Last Modified: 2015-01-02
I need a way to independently style a singular page within a wordpress site without affecting the other pages.

methods?
0
Comment
Question by:vanyab
  • 3
5 Comments
 
LVL 9

Expert Comment

by:Tom
ID: 40528774
Copy your theme template to a new name, modify this and apply it to the page.
0
 
LVL 9

Accepted Solution

by:
Tom earned 500 total points
ID: 40528781
When you have found the template you want to copy change the template name here:
_________________________________
<?php
/*
Template Name: NEW_NAME_HERE
*/
get_header(); ?>
__________________________________

Now you can select the new template when you edit your page
0
 

Author Closing Comment

by:vanyab
ID: 40528784
Simple. Thank you.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40528786
Styling a page differently is easy.  Tom's instructions above are how to create a new page template and you can then alter the structure of the page.  However, different styles can easily be achieved because WordPress adds the postID to the top-level classes on pages and posts automatically and you can use that to create custom styles in the main stylesheet.  The Codex reference for this is here:

http://codex.wordpress.org/Function_Reference/body_class#Examples

That page contains an exhaustive description of the process as well as CSS samples.  Short version, you do something like:

.page-id-2 {
	/* styles for only page ID number 2 */
}

Open in new window


Where "2" is the ID of the page or post you want to customize.
0
 
LVL 9

Expert Comment

by:Tom
ID: 40528789
My pleasure :-)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question