I’ve tried creating a page archiveheader.php and then in archive.php instead of <?php get_header(); ?> I use <?php get_archiveheader(); ?>
get_header() is a function, so what you just described is never going to work, unless you want to write another function.
create a file named whatever.php, put it inside your current theme’s directory.
Instead of using <?php get_header(); ?> use this:
<?php @include_once($_SERVER["DOCUMENT_ROOT"]."/wp-content/your-theme-name/whatever.php");?>
change the theme name obviously.
I thought maybe I could pass a different .php file to the function get_header. But like I said I don’t really know what I’m doing. What you suggested didn’t work for me. I have no header on that page, and all of the css formatting is gone. I guess the get_header function does more than just include the header.php file? I wouldn’t mind “rewriting” the get_header function, if you could tell me where it is. All I would have to do is change header.php to another name, and rename the function?
it calls header.php which is where your style.css is called yes.
what exactly are you trying to do?
What I provided does work — I use it all over my own site.
I’d like to add a custom get_header for my archive, so that the header is different, just for the archive.
you do not need to rewrite a function. What you need to do is LOOK at what header.php does, and include the bits of it that are necessary. Much of it is. Open it and look.
I assumed you had figured out that much if you were trying to call a different file.
My bad — never overestimate anyone on these forums.
I’m trying to add a custom header so that instead of showing my blog title and a description of the blog, it shows archive and what kind of archive is being shown.
What you need to do is LOOK at what header.php does, and include the bits of it that are necessary. Much of it is. Open it and look.
By include, I mean that you need to copy that file, and use IT as your base, change ONLY what needs to be changed to achieve your goal. leave the rest intact.
Okay, I got it to work now, the only thing I did differently is add a space:
<?php include_once($_SERVER[“DOCUMENT_ROOT”] . “/wp-content/themes/yourblog-20-theme/archiveheader.php”); ?>
instead of
<?php @include_once($_SERVER[“DOCUMENT_ROOT”].”/wp-content/themes/yourblog-20-theme/archiveheader.php”);?>
I don’t know why that would make a difference. I thank you for your help in spite your subtle insult towards me.