Jump to content
Killersites Forums

multiple stylesheets

Recommended Posts

What CMS are you using? Wordpress I'm assuming?


If so, here's one way to approach it:



Yes, WP is correct.


Thanks for this.... but is this also another way to do it?


<?php if ( is_page() ) { ?>

href="<?php bloginfo('template_url'); ?>

/page.css" type="text/css" media="screen" />

<?php } else { ?>

href="<?php bloginfo('stylesheet_url'); ?>"

type="text/css" media="screen" />

<?php } ?>

Link to post
Share on other sites

Rather than using <?php bloginfo('stylesheet_url'); ?> try <?php bloginfo('template_directory'); ?>.


I believe that <?php bloginfo('template_directory'); ?> gives you the path to your template's directory, and the stylesheet_url gives you the specific path to the styles.css file.


Either of your two code snippets above should work if you use template_directory instead.

Link to post
Share on other sites

<?php bloginfo('template_directory'); ?>



Nope, didn't work either. Im completely new to php/ wp theming so this is seriously driving me mad. 4:34 am, and still can't get it.


So far i went edit page > select the template "embassys" in the drop down menu and still its choking me to death with not working.


In the header of the "embassys" template i places the following exactly as is:




Template Name:embassys




<?php if( is_page('embassy') ) :?>

<?php else :?>

<?php endif;?>


.... then all my html follows.


Its just doesn't give.


the css is located as so > wp-content >themes > PNL4> embassys_list.css


on a side note: my default css is named "style.css". Since they are in the same folder could they be conflicting with each other?


I ended up just adding the css from the embassys_list.css to my default cause it wasn't working but my default css is gonna get outta control.

Link to post
Share on other sites

This looks incorrect to me:


I believe you have the closing quote around the css file in the wrong place. The way you have it at the moment, I believe it will generate:



Looks like that was partially my fault -- you had this error a couple posts up and I didn't catch it. Instead, change it to



If that doesn't fix it, one other thing to check is if the "/" within "/embassy_list.css" is causing an incorrect path. Off the top of my head, I'm not sure if the template_directory variable includes that ending slash or not. The way I usually handle this is to look at the source using firebug (or just looking at the source using the browser) and figuring out what incorrect path is currently being used and what path it should be.


If you are still having issues after trying all this, post or PM me the URL to the site? It's much easier to check things dealing with Wordpress/PHP if I can see the code that is being generated.


Since they are in the same folder could they be conflicting with each other?

It's possible that the contents of the two files would conflict if you used both at the same time, but just being in the same folder won't cause an issue.

Edited by falkencreative
Link to post
Share on other sites

Eric, lol... i know.


Im new to all this so there is a curve to learn. Believe it or not when you get some of it down, its pretty easy going.


But with this i just want to kill myself.


Some of the parts i thought were going to be the hardest were the easiest........ and the parts that i thought to be easiest are giving me ulcers.

Link to post
Share on other sites
OMG - all that work just to link to another style sheet! Admitidly, never tried wordpress or similar, but just doesn't seem worth it to me.


Wordpress is not terribly difficult to learn, though if you are a beginner, you'll struggle with some things early on. Doing something like this isn't that tricky for someone who knows what they are doing (no offense intended @straightryder). The more you work with the system, the easier it gets.


No bashing something until you've worked with it a bit. ;) I guarantee that not having to handcode everything every time you want to update a minor part of the site or add a blog post makes the initial pain of learning how to do things worth it.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...