• Hi,

    Is there a way to make the border under the nav bar one color for all single blog posts and a different color for all other pages?

    I tried adding

    <?php
    if(is_single()) {
    	#access a {
    		border-bottom: 1px solid #f00000;
    	}
    }
    else {
    	#access a {
    	border-bottom: 1px solid #000000;
    	}
    ?>

    to style.css but that makes the border disappear on all pages, and anyway I don’t even know if .css files can handle php code.

    I also tried adding

    #access a {
    		border-bottom: 1px solid #f00000;
    	}

    to single.php, but that makes single post pages come up blank, and anyway I don’t even know if .php files can handle css code.

    Maybe you can tell I am new to css and php.

    Thanks,
    Matt

Viewing 2 replies - 1 through 2 (of 2 total)
  • what theme are you using?

    the theme might have ‘body_class()’ which would add css classes to the body tag depending on the type of page/post you are on.

    Thread Starter Matthew Hutson

    (@mhutson)

    Thanks for your response. I’m using a child of twentyeleven.

    After several hours I found a solution. I created a duplicate of style.css called single_style.css and made the changes I wanted in there. And then in functions.php I added this:

    add_filter( 'stylesheet_uri', 'my_stylesheet', 10, 2 );
    function my_stylesheet( $stylesheet_uri, $stylesheet_dir_uri ) {
    	if(is_single() )
    		$stylesheet_uri = $stylesheet_dir_uri . '/single_style.css';
    	else
    		$stylesheet_uri = $stylesheet_dir_uri . '/style.css';
    	return $stylesheet_uri;
    }

    I’m not sure how the code above works, but it does.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can posts look different from other pages?’ is closed to new replies.