WordPress.org

Ready to get started?Download WordPress

Forums

Page Specific CSS (5 posts)

  1. prnoct90
    Member
    Posted 3 years ago #

    Hey, I want to implement and external style sheet for just one page of my wordpress site. I am running wordpress 3. Is there any easy way to do this? I found a plugin, but it doesn't seem to be compatible with WordPress 3...

  2. DigitalSquid
    Member
    Posted 3 years ago #

    http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    You could use the is_page() function to add the stylesheet link to that particular page.

  3. prnoct90
    Member
    Posted 3 years ago #

    1. If anyone knows a cleaner way, I would apreciate it.

    2. I'm not very good at php, so could someone give me an example of what using this properly might look like. I am trying to load an external stylesheet or create page wide style rules. Normally both of these have to be in the "<head>" section of a webpage I think.

  4. DigitalSquid
    Member
    Posted 3 years ago #

    In your header.php file, within the <head> tag and after all the other stylesheet links, add:

    <?php
    if(is_page('Page-Name')){
       echo '<link href="path/to/stylesheet.css" rel="stylesheet" type="text/css" />';
    }
    ?>
  5. prnoct90
    Member
    Posted 3 years ago #

    Okay, so that works for now, but might get a little unorderly with a lot of pages. Is there a cleaner solution. If not, thanks so much TFS for your time!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.