straightryder Posted March 13, 2010 Report Share Posted March 13, 2010 Okay, I have my index, single, header and footer linking to the main style sheet but when i create 'new page' and want to design my own template with its own stylesheet_2.css. How do i link to that stylesheet_2.css Thanks. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 13, 2010 Report Share Posted March 13, 2010 What CMS are you using? Wordpress I'm assuming? If so, here's one way to approach it: http://justintadlock.com/archives/2009/07/27/contextually-changing-your-themes-stylesheet Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 13, 2010 Author Report Share Posted March 13, 2010 What CMS are you using? Wordpress I'm assuming? If so, here's one way to approach it: http://justintadlock.com/archives/2009/07/27/contextually-changing-your-themes-stylesheet 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 } ?> Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 14, 2010 Author Report Share Posted March 14, 2010 <?php if( is_page(embassy) ) :?> <?php else:?> <?php endif;?> So far its recognizing the markup but not the stylesheet.... anyone know what im f'n up on? Im pulling my hair out. Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 14, 2010 Author Report Share Posted March 14, 2010 I found another site and tried it once again still nothing: <?php if( is_page('embassy') ) :?> <?php else :?> <?php endif;?> nothing but crickets around here an' me blabbing to myself. Thou this is getting fun when you start talking to yourself. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 14, 2010 Report Share Posted March 14, 2010 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. Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 14, 2010 Author Report Share Posted March 14, 2010 <?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. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 14, 2010 Report Share Posted March 14, 2010 (edited) 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 March 14, 2010 by falkencreative Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 14, 2010 Author Report Share Posted March 14, 2010 Thanks Falken... im gonna give it a shot now and get back to you in asap. Quote Link to comment Share on other sites More sharing options...
PicnicTutorials Posted March 14, 2010 Report Share Posted March 14, 2010 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. Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 14, 2010 Author Report Share Posted March 14, 2010 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. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 14, 2010 Report Share Posted March 14, 2010 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. Quote Link to comment Share on other sites More sharing options...
straightryder Posted March 14, 2010 Author Report Share Posted March 14, 2010 Falkencreative... I owe you. If you ever need a kidney let me know. Thanks for fixing this issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.