• Hi I made a custom page template and I want to attach a different css style to it instead of using the main style.css. How can I do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’ll have to modify the header for that file, because the call for the stylesheet for a file is done in the header, but basically, you’ll need to create a new header file and change this line:

    <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘stylesheet_url’); ?>” />

    to <link rel=”stylesheet” type=”text/css” href=”[url of your new stylesheet]” />

    Otherwise, I would suggest just adding the contents of the new css file to your old one, thus, you don’t have to worry about separate calls. If you have to, change the names of things, that’s a much simpler solution.

    I’m looking for clarity on this issue as well. Modifying the original header would just screw up all of the other pages. The CSS thing won’t work either (different looking pages). Do I really need to create a new header file? And if so, would I need to change:
    <?php get_header(); ?> to <?php get_*NEW HEADER FILE NAME*(); ?>
    in my new page template?

    I have the same issue.
    Loads of great posts showing how to make custom templates, which I’ve done, but none explaining the CSS.
    I tried

    just adding the contents of the new css file to your old one, thus, you don’t have to worry about separate calls. If you have to, change the names of things, that’s a much simpler solution.

    with no joy
    the theme i am using seems to call the stylesheet from index.php
    but what would i change in there?
    I guess i’d need it to call the normal style sheet ‘unless’ using ‘custom.php’ in which case it should call the custom.css?
    Any ideas on the php for that, or a better way to solve this?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘attach css to custom page template’ is closed to new replies.