Grow your CSS skills. Land your dream job.

HELP! Different style sheets for different pages?

  • # June 22, 2010 at 10:28 am

    Hey guys,

    Could some one help me out or direct me to a tutorial or something on how to create a different style sheet for sub pages so the background image on the index page doesn’t go through out the entire site? I’m not exactly sure how to create this??

    Link to site:
    http://nickswenson.com/

    Thanks,
    Nick

    # June 22, 2010 at 10:31 am

    I would duplicate your header.php file and rename it to header2.php and in there tell it a different style sheet to use. Then create a new template for a page. In that template page set header2.php to be included instead of the default header. Then go to your page that you created in wordpress and set the page template to the new one you made which includes the header2.php file.

    I think this will work and hopefully I explained it well enough, if not I can provide more info.

    Jake

    # June 22, 2010 at 12:35 pm
    "nutt318" wrote:
    I would duplicate your header.php file and rename it to header2.php and in there tell it a different style sheet to use. Then create a new template for a page. In that template page set header2.php to be included instead of the default header. Then go to your page that you created in wordpress and set the page template to the new one you made which includes the header2.php file.

    I think this will work and hopefully I explained it well enough, if not I can provide more info.

    Jake

    Thanks, Jake! You lost me tough on the template thing…could you explain that better?

    # June 22, 2010 at 12:43 pm

    Sure, I think you can just copy your index.php (maybe pape.php) but try index.php first. Once you have a copy of index.php change the name to something like secondstyle.php.

    Then open the secondstyle.php and at the very top add the following code.

    Code:
    < ?php
    /*
    Template Name: Second Style Sheet
    */

    Just save the file and go into the admin area of wordpress. Then go to your ‘pages’ section and the click on the page you want to have a different style sheet. Then when your in the edit area of this page on the left bottom of the page you will be able to choose the new template file called ‘Second Style Sheet’.

    The just save, and now that page when loaded should have that stylesheet you specified.

    Also if that doesnt work you may need to copy a different page instead of index.php, and maybe do page.php. Someone else may know better.

    Let me know if it works for you or if you have any other questions.

# June 23, 2010 at 8:13 pm

Why would you need to change the whole css file just to change site background ?!?!?
Change only ID on <body> tag, but use the same css file.

# June 23, 2010 at 11:36 pm

I do think that Azazul has a point, just give each body tag a class to change the background.

This is not related to your question, but I think you need to address the navigation which I noticed in your previous post. There is no rollover on the text and the menu does not dropdown on rollover. It requires 2 clicks from the small arrow to get to a page even if there is only one, and that is not very user friendly. :cry:

# August 17, 2010 at 12:27 pm

Navigation issue corrected. Thanks for the suggestions, guys!!

Nick

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".