Calling the wordpress header.php on a non wordpress page?

Discussion in 'PHP' started by crystak, Oct 16, 2008.

  1. #1
    I've got wordpress installed on a site but I want to call the wordpress header from my installation (header.php) into a non wordpress php page as I want to make a landing page and I want it to look the same like the actual wordpress site.

    So, the easiest way would be to just call this into the page. Is it possible? I've added
    <?php get_header(); ?>
    PHP:
    at the top of this new page but I get this error when I access the page. All the files are in the same directory.

    Fatal error: Call to undefined function get_header() in /home/username/public_html/sitename/wp-content/themes/gossip/contest.php on line 4

    Now, I don't know PHP, could someone translate that to me and advise me if what I want to do is even possible, and give me some guidelines? :).

    Thank you!
     
    crystak, Oct 16, 2008 IP
  2. bigroddy

    bigroddy Peon

    Messages:
    78
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You'll have to include the file that the 'get_header()' function is defined in, in order for that to work.

    I'm pretty new to wordpress myself so I don't know off the top of my head where it's located...give me a couple min and I'll find it.
     
    bigroddy, Oct 16, 2008 IP
    crystak likes this.
  3. bigroddy

    bigroddy Peon

    Messages:
    78
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It's in the general-template.php file inside of 'wp-includes' which should be in the directory you installed WP in...

    You would also need to have the app info file (not sure what it's called in WP) with the template path available...
     
    bigroddy, Oct 16, 2008 IP
  4. crystak

    crystak Well-Known Member

    Messages:
    1,121
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    115
    #4
    Hmm, thanks for the reply! I've sorted it out somehow, not quite how I wanted to though but I'll keep working on it.

    Cheers!
     
    crystak, Oct 16, 2008 IP
  5. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #5
    You would have to include a long list of files to make it work just like a WP page. Wouldn't it be easier to create the landing page in wordpress and customize the appearance for that page ( stuff like dropping the sidebar etc).
     
    shallowink, Oct 16, 2008 IP
  6. crystak

    crystak Well-Known Member

    Messages:
    1,121
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    115
    #6
    Well I just want the header and the background to be like the WP page, nothing else. But I'm using an iframe and a script that for some reason don't work with wordpress even when I hard code it into the files so I have to use a separate page.
     
    crystak, Oct 16, 2008 IP
  7. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You should be able to do it all within the WP system. Look at http://www.expressandstar.com/ which uses WP as a portal. This site is tricked out to the max.
     
    Dodger, Oct 16, 2008 IP