• Resolved blastkist

    (@blastkist)


    Here is what I want. For my tutorial pages (hierarchy) will be

    Tutorials
    -Photoshop
    -Paint Shop Pro
    -Blah blah
    -Blah blah

    I have my page.php setup the way I want, only thing is the header.php calls my stylesheet with the banner for the other parts of the site, my blog mainly. I want a “tutorials” header img there instead, which I have created.

    Since my header is from the CSS and page.php already has that called whenever I view my tutorial pages, I get my blog’s header.

    I want it to call instead the new stylesheet (which I called tutstyle.css) for those pages which includes the tut header img instead.

    What php do I need to add to my header to do that?I’m a php copy paster…I hate coding LOL! I’ve tried various things and nothing works so far. It just won’t call that other stylesheet instead.

    Help?

Viewing 11 replies - 1 through 11 (of 11 total)
  • I’m not really sure about this, but this has been asked a number of times before if I remember right. And since I know you’re not really up to reading through the codex on this, I’ll try and help ya the best I can with codes and information in this reply.

    Make a second header.php file..maybe called header2.php. Have all the codes in that second one, as you have in the first one. Just replace this:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    With this:
    <link rel="stylesheet" href="domain.com/path/to/your/tutstyle.css" type="text/css" media="screen" />

    Then in the page.php file, replace this:
    <?php get_header(); ?>

    With this:
    <?php
    require(‘./blog/header2.php’);
    ?>`

    Or whatever the path is really. But again, I’m not positive because I never had done this before. =/ But, if I’m wrong, which I am most likely..some other guru that knows more about this, will help ya.. =D

    spencerp

    Here’s one way:

    Open up the page.php that you have got just right.
    Open up the header.php
    Copy the header.php INTO the page.php – the idea is to join the two parts together.
    Then you change the css url as spencerp says
    Then you save it as ‘page2.php’ and when you make / write the page in question, you select ‘page2’ as the template.

    Does that sound like it could work?
    If not, post back – there are other ways.

    Thanks for posting a reply podz. =D I know I probably shouldn’t have sent an email through the wp-forums list about my previous reply.

    But I just didn’t want he/she, to possibly really mess up their blog, because of my incorrect answer on it. =/ =( At first I was going to post some links to the codex, but knew they were more of a copy/paste type of person lol..so I didn’t do that.. =D

    spencerp

    Also, some others that are good at answering this, is Kaf and HandySolo.. =)

    Thread Starter blastkist

    (@blastkist)

    Thanks guys. Ok Pods, I’m going to give your technique a try. Spencer, hehe…I did read through the codex on this but nothing seemed to jive so I didn’t want to risk messing up. This seems pretty straight-forward anyway.

    I’m going to give that a try and see what that does. At least I’m not messing with my template files that way and I can always delete the page if it doesn’t work. I’ll get back to you on it and see what came of it.

    I’m going to check again but if I’m not mistaken, the creator of this template placed an @import instead of this traditional CSS call into the header.php. So that seemed to break my CSS every time I tried to offer up the <link method, it just wouldn’t take the new method of linking my stylesheet and I had done it over and over again to make sure everything was just right. Oh and I’m a “her” LOL!

    I do so appreciate the help though.

    Thread Starter blastkist

    (@blastkist)

    <style type="text/css" media="screen">
    /*<![CDATA[*/

    @import url( <?php bloginfo('stylesheet_url'); ?> );

    /*]]>*/
    </style>

    This is how he has it in the header.php It’s a little different than your method and just want to be sure I’m deleting and replacing the correct stuff here.

    Thread Starter blastkist

    (@blastkist)

    Oh My Gosh I love you guys! It worked! Yaaaaahoooooo! I’d been wracking my brains with it. I just made sure to exclude the call to the header in the mainpage template and voila! Just what I needed.

    See how wonderful you are?

    (mooooahhhhh!)

    https://dreamkist.com/blog/tutorials

    Spencer, hehe…I did read through the codex on this but nothing seemed to jive so I didn’t want to risk messing up. This seems pretty straight-forward anyway.

    Haha..yeah, I’m not one for reading really, seems alot easier to just have the short and sweet answers placed right infront of me lol!

    I’m going to check again but if I’m not mistaken, the creator of this template placed an @import instead of this traditional CSS call into the header.php. So that seemed to break my CSS every time I tried to offer up the <link method, it just wouldn’t take the new method of linking my stylesheet and I had done it over and over again to make sure everything was just right.

    Hmm..I never had a theme that did that CSS call method before.. =/ So I’m not too sure about how to do that one.. maybe after a few good beers or something, I’d prolly understand it better LoL!

    Oh and I’m a “her” LOL!

    Hehe, yeah..I knew that lol. I had took a gander at the photos on your blog. =D We just use “he/she” or “heesh” when refering to or about others, because you never know if someone that is female posts the original thread, but then maybe their “boyfriend/hubby” posts a reply later. Kind of a “be on the safe side” method ya know lol? =D

    spencerp

    Awesome! Glad to hear it’s working.. [Saying while.. blushing].. =D

    spencerp

    atheista

    (@atheista)

    can someone explain this to someone who has a tech skills of a total retard? it’s all greek to me. ??

    atheista

    (@atheista)

    resolved. thanks

    buzzy

    (@buzzy)

    Not sure if this thread is still being looked at all, but there is an easier way to do this so that you don’t have to have a completely separate style sheet.

    I’m also hoping there is a way to make it even easier by assigning a css class to the body tag of the second template, but I haven’t seen this anywhere.

    Rather than designating a different style sheet, do this: when you paste the header.php code into the spot where the <?php get_header(); ?> script appears, just assign a class to the <body> tag.

    For example, use <body class=”secondpage”> for your template page.

    Then in your style sheet use

    body.secondpage {
    background-image:url(whatever.gif);
    }

    You can change anything you want in this way, like a background for a div#content:

    body.secondpage #content {
    background-image:url(whatever-2.gif);
    }

    Cool, eh?

    Now, can someone please tell me how to avoid having to paste all my header.php code into the index-second.php template file – or whatever? There has got to be a better way!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Changing header via CSS in my theme’ is closed to new replies.