Different themes for every page?
-
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 ??
-
Related post with some great help from Lorelle, here:
https://www.ads-software.com/support/topic/41066.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.
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 asmystyle.css
and modify the images and everything you want to change.
When it works, you can start to make asidebar1.php
and replace theget_sidebar
call in the new Page template with the include call for the sidebar1…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!
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.
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.
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.
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! ??
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?
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.
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.
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
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.
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 ??
You cannot use this:
<?php get_header2(); ?>
this function is not defined (it works only for “header” not header2.
INstead you should use
<?php include ('header2.php'; ?>
or
<?php include (TEMPLATEPATH . '/header2.php'); ?>
- The topic ‘Different themes for every page?’ is closed to new replies.