ThemeShaper Forums » Thematic

[closed]

Using multiple custom stylesheets

(7 posts)
  • Started 4 years ago by tarpontech
  • Latest reply from tarpontech
  • This topic is not a support question
  1. I found bits and pieces of this around the forum, I glued this together to do what I want but..it ain't working...any advice? I get the first if statement to fire, but all subsequent pages use the elseif statement, and nothing gets the last else.

    //Custom Stylesheets for different pages!
    
    function custom_stylesheets() {
    
    	$pageID = $wp_query->post->ID;
    
    	if (is_front_page()) {?>
    	    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet1.css" />
    		<?php 
    
    	} elseif ($pageID = '2') {?>
    	    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet2.css" />
    		<?php 
    
    	} else {?>
    	    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet3.css" />
    		<?php
    			}
    		}
    	add_action('wp_head', 'custom_stylesheets');
    Posted 4 years ago #
  2. doh...nevermind....just needed to refresh my memory on conditional tags... http://codex.wordpress.org/Conditional_Tags

    this does what I want...

    'function custom_stylesheets() {

    if (is_front_page()) {?>
    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet1.css" />
    <?php

    } elseif (is_page('about')) {?>
    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet2.css" />
    <?php

    } else {?>
    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet3.css" />
    <?php
    }
    }
    add_action('wp_head', 'custom_stylesheets');
    '

    Posted 4 years ago #
  3. as a side note, i tried using an array of pages, such as:

    '} elseif (is_page(array('about','contact','yurmomma')) {?>
    <link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory') ?>/stylesheet2.css" />
    <?php '

    but it blew up. Anyone have any insight into why this array doesn't work? I'm using WP 2.8ish and the current release of thematic.

    Posted 4 years ago #
  4. You're missing the closing )

    (is_page( array( 'about','contact','yurmomma' ) ) )

    Posted 4 years ago #
  5. Thank you sir! I couldn't for the life of me figure out what was wrong.

    *note to self: Increase font-size*

    Posted 4 years ago #
  6. heck yeah bigger font sizes! you may also want to try something like Notepad++ (which is free) and does syntax highlighting. so if i highlight one squiggly { its partner } will also change color. if there is no color change then my poor squiggly is all alone in the world and stuff is gonna break. :)

    http://download.cnet.com/Notepad/3000-2352_4-10327521.html

    Posted 4 years ago #
  7. Dreamweaver's syntax highlighting gets flaky on me with php, but i'm soo used to it helping me cheat with css. I'm going to d/l and use n++ for a few days and then try the eclipse php module as well. thanks for the quicky link!

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.