You have to add on the top of any file that needs to use WP functions, the following:
<?php
require('./path-to/your-blog/wp-blog-header.php');
?>
Right on the top, before everything.
Thanks. I’m still having a problem. Here’s the code (without any content stuff so it’s easy to read):
<?php
require('./wordpress/wp-blog-header.php');
?>
<?php get_header(); ?>
<!-- content ................................. -->
<div id="singletop"></div>
<div id="content">
</div> <!-- /content -->
<?php get_footer(); ?>
My blog address is located in my “wordpress” folder in the root directory.
Here is the error I get:
Fatal error: main(): Failed opening required ‘./wordpress/wp-blog-header.php’ (include_path=’.:/usr/local/lib/php’)
And it goes on to tell me that the error is on line 2. What am I doing wrong?
Thanks so much for your help.
Ryan
By the way, the directory for this page is as follows:
wordpress/wp-content/2005/2005.php
One more thing. It has it’s own folder because it has an images folder and thumbs folder that it draws from. I plan on duplicating these folders in their own directories (2004, 2003, 2002, etc..). This way I do not have to chance any of the HTML. Makes my life a lot easier.
Ryan
./wordpress/wp-blog-header.php isn’t going to work since the path to the header isn’t in the wordpress folder – it’s probably in something like
/wordpress/wp-content/themes/yourtheme/wp-blog-header.php
“By the way, the directory for this page is as follows:“
Then you should try:
<?php
require('../../wp-blog-header.php');
?>
Look up “relative paths” in your favorite search engine for helpful info on the topic.
My “wp-blog-header.php” is in my wordpress folder. “header.php” is in my themes folder.
When I use an absolute path to my header (header.php), some things work but the dynamic content does not show up. Plus, it leaves out the whole template.
Thanks Kafkaesqui and ladydelaluna. Still the same error message.
try using the entire url – from http
onward…
Tried that also. Now it tells me:
Fatal error: Call to undefined function: get_header()
I’m going bonkers. That function works when the page is created through the WP Admin. But when I tried to type in the url of any page in my theme directory it says the same thing.
Just for lady:
wp-blog-header.php and (a theme’s) header.php are two (2) very different things!
when I tried to type in the url of any page in my theme directory it says the same thing
I am not sure I understand this. What exactly are you trying to do?
i think he’s trying to get his theme’s header to show up elsewhere, and has saved it in another location… sorry if i misunderstood.
No, the header is in the same place it always has been, my theme’s folder. I understand the reason for moshu’s solution but it isn’t working. Thanks for trying though guys.
Ryan
i think the problem is that you’re trying to use stuff inside the wordpress theme to make pages outside the wordpress directory…
why not just install wp on the root dir and then build a blog from that?