WordPress.org

Forums

[resolved] Different themes for every page? (34 posts)

  1. jennibee
    Member
    Posted 9 years ago #

    Can you have a totally different lay-out for every page? I read up on how to change headers, but can you change the entire layout for each one? Would I just have to have x amount of style.css, sidebar, header, etc? I just wanted one page different, the rest can stay the same. Thanks for any help :)

  2. moshu
    Member
    Posted 9 years ago #

    Are you talking about Pages as opposed to posts - or just webpages? For Pages you can have different templates

  3. jennibee
    Member
    Posted 9 years ago #

    Well, I'd like to use the same lay-out, where things are placed on my site. I just wanted to change the graphics, font colors, etc. I use wordpress not just for my blog but my overall website so everything looks flawless. I wanted to make a wedding page with different graphics. I'm just trying to figure out how hard it would be.

    I just looked over those links and nothing is really helping. Thanks though! Hopefully I can figure it out.

  4. moshu
    Member
    Posted 9 years ago #

    I doubt you could read through those Codex pages in 6 minutes, and if your request is as vague as it is... we cannot help.

  5. jennibee
    Member
    Posted 9 years ago #

    I've read those Codex pages in the past quite a few times. I went through them twice before I posted here. Anyway, I didn't think I was being vague. I just wanted to know if I *can* change all of the graphics on just one "Page". Make a new graphics cover for it. Thats it. If I can, I'll figure it out somehow, I'm just wondering if anyone else has sucessfully done it.

  6. moshu
    Member
    Posted 9 years ago #

    If it is about Pages, then the answer is yes. You have to create a Page template (including different graphics etc. - see the link above) and after that going into your admin panel Write > Write Page create a new Page by choosing the newly created template from the dropdown menu.

  7. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Yes. You can. I have done for others.
    Make a complete new template, use that when you make the page.
    The codex links describe how.

  8. jennibee
    Member
    Posted 9 years ago #

    Let me run this by you...

    Say that I just open my page.php file, where it says things like "get header", etc, should I erase that and add the straight img url? Otherwise I'd be getting my default header, footer, etc, right? I'm sorry if I sound completely stupid, I shouldn't work on things like this at all hours of the morning.

  9. moshu
    Member
    Posted 9 years ago #

    where it says things like "get header", etc, should I erase that and add the straight img url?
    NO!
    Without the header.php it won't work. Look here how the templates work together in a theme.
    WHat theme are you trying to modify? The specific answers might differ based on the theme.

  10. jennibee
    Member
    Posted 9 years ago #

    I'm using Jakarta, although I changed all of the backgrounds and other graphics.

    My website url is http://www.grabertfamily.com

  11. Mark (podz)
    Support Maven
    Posted 9 years ago #

    jennibee - what have you tried, and can you indicate where you have tried so we can see your code ?
    (I mean on your site, please do not post code here)

  12. moshu
    Member
    Posted 9 years ago #

    For what you want to achieve there several different ways. E.g.
    1. You can create a different header for the specific Page template where you would be able to call for a different stylesheet and different header image. It is also possible to call a different footer or any other part of the page. In this case you cannot use the WP functions "get_header" - you have to go with an include.
    2. You can use an if statement in the existing header (see: Conditional_Tags ) to call for another header image.

  13. jennibee
    Member
    Posted 9 years ago #

    I haven't really kept anything I've tried because it hasn't worked and doesn't look like it'll ever work.

    What I'm not clear on is how you get new graphics to show up. Do you have to make a style2.css, footer2.php, etc? I get how to make new pages and how to erase/add things you want in the over-all layout of the page, but for some reason I'm not seeing how to actually change the graphics. Give me a few hours, if I still can't get it, I'll just leave it be.

    Edit:

    I posted before I got to read the last post. Conditional tags sound like fun, I'll have to read up on those. Thanks!

  14. Amulet
    Member
    Posted 9 years ago #

    I'm glad you asked this, Jennibee. I understood what you meant, but I just got here, so I couldn't have answered, had I known what to tell you. But, while I hadn't considered it before, I'm interested in this information; I've always assumed that if I wanted to make a page with a completely different look, I'd have to do it outside of WordPress. Thanks for asking; now I know. :)

  15. jennibee
    Member
    Posted 9 years ago #

    I'm still slightly confused. Can anyone tell me exactly which files I need to make duplicates of for each different template? That would probably be the biggest help at this point.

  16. jennibee
    Member
    Posted 9 years ago #

    As a test, I changed all of my links in my sidebar (manually, not through wordpress) and in my horizontal menu in my header and they changed, but the graphics aren't showing up. I have them as header2 and sidebar2 and they seem to be working except absolutely none of the graphics are showing up.

    This is what it does:

    http://grabertfamily.com/?page_id=6

    I changed the index.php, made a copy of page.php, header.php and sidebar.php. Anyone know what I may be doing wrong?

  17. monkeypup
    Member
    Posted 9 years ago #

    Related post with some great help from Lorelle, here:
    http://wordpress.org/support/topic/41066.

  18. jennibee
    Member
    Posted 9 years ago #

    Yeah, I've seen that thread...my problem is that in my header.php, there isn't a line of code that says what the graphic is. That sits in my style sheet and I'm not sure if you need to change that. The codec is great for making pages, but it (to me) doesn't explain how to change the graphics.

  19. moshu
    Member
    Posted 9 years ago #

    OK, I'd go in this way:
    All you need a new page template and a stylesheet. Sidebar and footer will be the next step.
    In the header.php where the call for stylesheet is, you need something like this:
    <style type="text/css" media="screen">
    if ( is_page('X') ) {
    include(TEMPLATEPATH . '/mystyle.css');
    } else {
    include(TEMPLATEPATH . '/style.css');
    ?>
    </style>

    (I am not a coder, so no guarantee it will work, but it shows the idea :) - X is the page_id of your "wedding" Page or whatever.
    Then you will save your existing stylesheet as mystyle.css and modify the images and everything you want to change.
    When it works, you can start to make a sidebar1.php and replace the get_sidebar call in the new Page template with the include call for the sidebar1...

  20. jennibee
    Member
    Posted 9 years ago #

    That makes things clearer. I just make a new style sheet with all of the new graphics in it and point the header in that direction? I've already got a new sidebar and footer written up, so I'll go try that and see how it works. Thanks again!

  21. moshu
    Member
    Posted 9 years ago #

    The code I posted above (if I am not totally wrong) says that if we are on the page_id=X --> use the mystyle.css, otherwise use the usual style.css.

  22. jennibee
    Member
    Posted 9 years ago #

    Well, I decided to try something just to make sure that I was using the style sheet right. I uploaded "style2.php" as style.php so that my main blog would see it as the normal style sheet, and that worked, the other graphics are there. So I guess my problem is that I can't seem to get the header programed right. The footer, sidebar and all that are working just fine, but when I try to make header2.php, its not working like it should.

  23. Amulet
    Member
    Posted 9 years ago #

    I think your style sheets need to be .css, not .php. I don't know if that would affect your header2.php in any way, but style sheets are .css files.

  24. jennibee
    Member
    Posted 9 years ago #

    Oops, I meant .css, all of my style sheets are .css!

    My style sheet works right, its the second header.php or page.php files that aren't working. None of the graphics show up, I think its because I'm not pointing it to the style sheet correctly. Where you're supposed to put the code about the style sheet that moshu posted, it looks really different in my original template. I tried to find some simplier templates and they are all about the same. I'm almost there, I just have to figure out this one last little thing! :)

  25. Amulet
    Member
    Posted 9 years ago #

    I'm not sure (I'm not a coder, either), but I would think you couldn't use TEMPLATEPATH for both style sheets, unless they're in the same location. If you create a completely different theme (which, I'd assume, would have its own directory), I think you'd need to put in the path to the alternate theme. I think you could either put in the path, or create an alternate somewhere in the script that tells how TEMPLATEPATH is defined (meaning, you'd call it something else, i.e. TEMPLATEPATH2, with its own path set). I'm sorry if I confuse you here; I'm just guessing, and I'm always asking questions here when I work with WP myself. :)

    I have a related question. I'm using the theme switcher, and I've found the length of the theme names can push the dropdown bar (which I chose to use) past the side bars, into the content area. I'm sure I can change the theme names somewhere, can't I? I just want to shorten them, not actually change them (right now, it's only one--"identification-band-triplet-centered-girlish"), just so they'll fit. That wouldn't violate anyone's copyright or anything, would it? Can someone tell me how to do this?

  26. jennibee
    Member
    Posted 9 years ago #

    Hmm, I'm not really sure how to do that. Try changing the name of the theme in the style.css file. I think thats changed it for me in the past.

    Also, when I put the line of code for a header in page2.php, it gives me massive errors. Anyone know what the "Correct" code would be? The file's name is header2.php.

  27. jennibee
    Member
    Posted 9 years ago #

    Ok, I think I got the header-page part fixed, but I can't get my style sheet pointed to my header. This is the line of code in my header:

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

    How would I change that to style2.css? They both sit in the same directory.

  28. jennibee
    Member
    Posted 9 years ago #

    Ok, so I don't have the header-page thing figured out...
    This is what it gives me to work with:
    <?php get_header2(); ?><div id="content" class="narrowcolumn">
    <div id="headerimg">

    I looked in about 20 threads about it and tried changing it to what everyone said and it gives me the same error everytime:

    Fatal error: Call to undefined function: get_header2() in /home/grabert/public_html/wp-content/themes/my wp template/page2.php on line 7

  29. Amulet
    Member
    Posted 9 years ago #

    Thanks, Jennibee, that worked! (By the way, I assume you're a Jennifer...me, too! We rule the world!)

    BACKUP your files before trying this (if you do)!!! After looking around a little more, I'm thinking you have to edit wp-includes/template-functions-general.php in the first function, that looks like this (similar to the code moshu gave you, only his [hers?] probably would do what you wanted, more specifically, calling the usual header, unless the specific page(s) were called, then it would show the other header, and failing that, it should call the default header):

    function get_header() {
    if ( file_exists( TEMPLATEPATH . '/header.php') )
    load_template( TEMPLATEPATH . '/header.php');
    else
    load_template( ABSPATH . 'wp-content/themes/default/header.php');
    }

    MAYBE you need to add another function like this:

    function get_header2() {
    if ( file_exists( TEMPLATEPATH . '/header2.php') )
    load_template( TEMPLATEPATH . '/header2.php');
    elseif( file_exists( TEMPLATEPATH . '/header.php') )
    load_template( TEMPLATEPATH . '/header.php');
    else
    load_template( ABSPATH . 'wp-content/themes/default/header.php');
    }

    But to make that work, I think you'd need to call the function in your page, like this:

    <?php get_header2(); ?>

    I'm probably wrong, but it's a guess. You might also be able to set some kind of case thing in that same file where it says function get_bloginfo($show=''), but I really can't say.

    Hopefully, someone who really knows can answer you for sure, but it's something to try in the meantime.

  30. jennibee
    Member
    Posted 9 years ago #

    Well, that sort of worked! But now my blog is all messed up. I'll go from what you said and see if I can't tweak it.

    And, yep, I'm a Jennifer, but no one calls me that but my Grandma ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.