Mohidul Islam
Member
Posted 10 months ago #
Hello everybody,
Help me please. I am using twentyten theme. I wanted to create some custom page like About Us, Login, Register etc.
Page template has been created. But problem is the css file. When I created a div id or class. And write some styles. There have no changes.
Now how can I write stylesheet for my custom page template.
What Can I Do Now ?
Regards,
Mohidul Islam
serpico
Member
Posted 10 months ago #
I would suggest adding the custom styles to the usual style.css file. You can apply your CSS code to specific pages by selecting elements using the body class. Details of this can be found within the codex here:
http://codex.wordpress.org/Function_Reference/body_class
Mohidul Islam
Member
Posted 10 months ago #
Thanks for you reply serpico .
I am try to add styles in style.css. But doesn't work. What can I do for work in style.css file.
Mohidul Islam
Member
Posted 10 months ago #
My custom page is about.php
serpico
Member
Posted 10 months ago #
Can you provide a link to your custom about page?
Mohidul Islam
Member
Posted 10 months ago #
Oh reasy sorry serpico,
That is my localhost.
serpico
Member
Posted 10 months ago #
Take a look at the source code, you will see the body tag has a number of classes. One of these will be a specific page id.
For example, you can then use the CSS:
body.page-id-4 #wrapper { background-color:#000 !important }
This will select the tag with an ID wrapper within the Page ID 4.
Arie Putranto
Member
Posted 10 months ago #
Or you can add another stylesheet to your theme directory and load it using conditional tags.
For example:
On your function.php
// Replace # with the ID of your custom page
if ( is_page( # ) ) {
wp_enqueue_style( 'path/to/your/custom/css/file' );
}
else wp_enqueue_style( 'path/to/your/original/css/file' );
But if you only add minor change to the style, @serpico way would be proper.